Xwayland: fix possible use-after-free on unmap
The view.unmap() call may synchronously destroy the view, which makes the the code removing listeners which is currently run after view.unmap() access free'd memory. To fix this, simply change the order of the calls to match that of XdgToplevel.handleUnmap().
This commit is contained in:
parent
556d790694
commit
7013bc3b69
1 changed files with 2 additions and 2 deletions
|
@ -214,12 +214,12 @@ fn handleMap(listener: *wl.Listener(*wlr.XwaylandSurface), xwayland_surface: *wl
|
||||||
fn handleUnmap(listener: *wl.Listener(*wlr.XwaylandSurface), xwayland_surface: *wlr.XwaylandSurface) void {
|
fn handleUnmap(listener: *wl.Listener(*wlr.XwaylandSurface), xwayland_surface: *wlr.XwaylandSurface) void {
|
||||||
const self = @fieldParentPtr(Self, "unmap", listener);
|
const self = @fieldParentPtr(Self, "unmap", listener);
|
||||||
|
|
||||||
self.view.unmap();
|
|
||||||
|
|
||||||
// Remove listeners that are only active while mapped
|
// Remove listeners that are only active while mapped
|
||||||
self.commit.link.remove();
|
self.commit.link.remove();
|
||||||
self.set_title.link.remove();
|
self.set_title.link.remove();
|
||||||
self.set_class.link.remove();
|
self.set_class.link.remove();
|
||||||
|
|
||||||
|
self.view.unmap();
|
||||||
}
|
}
|
||||||
|
|
||||||
fn handleRequestConfigure(
|
fn handleRequestConfigure(
|
||||||
|
|
Loading…
Reference in a new issue