smithay icon indicating copy to clipboard operation
smithay copied to clipboard

xwm memory leak in MapRequest handler

Open luveti opened this issue 2 years ago • 1 comments

I've wrote a GTK4 application (using https://gtk-rs.org) and was testing it in my compositor. I noticed when I close this application, several X11 windows would be left behind.

The GTK4 application maps itself 3 times for some reason, without first unmapping itself. This occurs on the simplest example app.

When I close the app, 2 windows are left behind. I believe I've tracked it down to this code here: https://github.com/Smithay/smithay/blob/master/src/xwayland/xwm/mod.rs#L1357-L1405e

This is not checking if surface.state.lock().unwrap().mapped_onto.is_some(), adding this check fixes the leak. Would this be the correct fix? Or should we be performing anything that's done inside this block https://github.com/Smithay/smithay/blob/master/src/xwayland/xwm/mod.rs#L1536-L1579

luveti avatar Sep 04 '23 06:09 luveti

That surely is an interesting bug.

When I close the app, 2 windows are left behind. I believe I've tracked it down to this code here: https://github.com/Smithay/smithay/blob/master/src/xwayland/xwm/mod.rs#L1357-L1405e

I don't see any other important logic in MapRequest that would be skip by this solution, so I think this is a good approach. Please feel free to make a pull request.

Drakulix avatar Sep 04 '23 09:09 Drakulix