river: properly teardown surface tree
When an xdg toplevel, layer surface, etc is destroyed, it is not guaranteed that all the children in the surface tree have already been destroyed. If there are still children around, destroying the root of the tree would leave dangling pointers. To fix this, destroy all children when destroying any node in the tree.
This commit is contained in:
@ -82,6 +82,12 @@ fn handleDestroy(listener: *wl.Listener(*wlr.LayerSurfaceV1), wlr_layer_surface:
|
||||
self.commit.link.remove();
|
||||
self.new_subsurface.link.remove();
|
||||
|
||||
Subsurface.destroySubsurfaces(self.wlr_layer_surface.surface);
|
||||
var it = wlr_layer_surface.popups.iterator(.forward);
|
||||
while (it.next()) |wlr_xdg_popup| {
|
||||
if (@intToPtr(?*XdgPopup, wlr_xdg_popup.base.data)) |xdg_popup| xdg_popup.destroy();
|
||||
}
|
||||
|
||||
const node = @fieldParentPtr(std.TailQueue(Self).Node, "data", self);
|
||||
util.gpa.destroy(node);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user