From 4b3c8d07b445a9410c8697a85cf50f7f42d116cc Mon Sep 17 00:00:00 2001 From: Victor Kareh Date: Fri, 21 Nov 2025 17:38:44 -0500 Subject: daemon: Fix idle reposition source removal warning When a notification is removed from the hash table, any pending idle reposition source must be explicitly canceled in to avoid attempting to remove an already-removed source. This prevents the race condition where the timeout fires and auto-removes itself before the notification cleanup tries to cancel it. --- src/daemon/daemon.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/daemon') diff --git a/src/daemon/daemon.c b/src/daemon/daemon.c index d28266d..e5033de 100644 --- a/src/daemon/daemon.c +++ b/src/daemon/daemon.c @@ -286,12 +286,25 @@ static void notify_daemon_class_init(NotifyDaemonClass* daemon_class) static void _notify_timeout_destroy(NotifyTimeout* nt) { + gpointer value; + /* * Disconnect the destroy handler to avoid a loop since the id * won't be removed from the hash table before the widget is * destroyed. */ g_signal_handlers_disconnect_by_func(nt->nw, _notification_destroyed_cb, nt->daemon); + + /* Cancel any pending idle reposition for this notification */ + if (g_hash_table_lookup_extended(nt->daemon->idle_reposition_notify_ids, + GINT_TO_POINTER(nt->id), + NULL, &value)) + { + guint source_id = GPOINTER_TO_UINT(value); + g_source_remove(source_id); + g_hash_table_remove(nt->daemon->idle_reposition_notify_ids, GINT_TO_POINTER(nt->id)); + } + gtk_widget_destroy(GTK_WIDGET(nt->nw)); g_free(nt->app_name); -- cgit v1.2.1