git.lucas.co / cce-compositor
Wayland compositor (wlroots)
git clone https://git.lucas.co/cce-compositor.git

commitefbbed2c10fdf452cc222ba4d7b2120ca9d25d6f
parent28776fcf4f
authorIsaac Freund <[email protected]>
date2021-09-30 16:45
Subsurface: remove commit listener in destroy()

Currently if destroy() is called while a subsurface is mapped a dangling
commit listener is left behind. This is obivously a problem, so check if
the subsurface is mapped in destroy() and remove the listener if needed.

 river/Subsurface.zig | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/river/Subsurface.zig b/river/Subsurface.zig
index 0880163..bf7c341 100644
--- a/river/Subsurface.zig
+++ b/river/Subsurface.zig
@@ -95,6 +95,8 @@ pub fn destroy(subsurface: *Subsurface) void {
     subsurface.unmap.link.remove();
     subsurface.new_subsurface.link.remove();
 
+    if (subsurface.wlr_subsurface.mapped) subsurface.commit.link.remove();
+
     Subsurface.destroySubsurfaces(subsurface.wlr_subsurface.surface);
 
     subsurface.wlr_subsurface.data = 0;