From 0925fe956aeddb983875f0fd892e9049e2d8cb76 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Leonardo=20Hern=C3=A1ndez=20Hern=C3=A1ndez?=
 <leohdz172@proton.me>
Date: Thu, 16 Jan 2025 19:02:02 -0600
Subject: [PATCH] unlink some destroy listeners

Recently wlroots was updated to assert that signals do not have listeners
attached on destroy.

This is just a preliminar work to fix dwl. At the moment dwl will trigger the
assertions at exit.

References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4918
---
 dwl.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/dwl.c b/dwl.c
index ea66483..d9d9f95 100644
--- a/dwl.c
+++ b/dwl.c
@@ -1176,6 +1176,7 @@ destroydragicon(struct wl_listener *listener, void *data)
 	/* Focus enter isn't sent during drag, so refocus the focused node. */
 	focusclient(focustop(selmon), 1);
 	motionnotify(0, NULL, 0, 0, 0, 0);
+	wl_list_remove(&listener->link);
 }
 
 void
@@ -1184,6 +1185,7 @@ destroyidleinhibitor(struct wl_listener *listener, void *data)
 	/* `data` is the wlr_surface of the idle inhibitor being destroyed,
 	 * at this point the idle inhibitor is still in the list of the manager */
 	checkidleinhibitor(wlr_surface_get_root_surface(data));
+	wl_list_remove(&listener->link);
 }
 
 void