summaryrefslogtreecommitdiff
path: root/src/daemon/daemon.c
diff options
context:
space:
mode:
authorVictor Kareh <[email protected]>2025-11-21 17:38:44 -0500
committerVictor Kareh <[email protected]>2026-01-19 14:44:34 -0500
commit4b3c8d07b445a9410c8697a85cf50f7f42d116cc (patch)
tree5e76ad2490bb3c2063e580449cddd4bb0344edeb /src/daemon/daemon.c
parent24ee308028d86ea9167d7123a59cc654f2697cc1 (diff)
downloadmate-notification-daemon-4b3c8d07b445a9410c8697a85cf50f7f42d116cc.tar.bz2
mate-notification-daemon-4b3c8d07b445a9410c8697a85cf50f7f42d116cc.tar.xz
daemon: Fix idle reposition source removal warningHEADmaster
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.
Diffstat (limited to 'src/daemon/daemon.c')
-rw-r--r--src/daemon/daemon.c13
1 files changed, 13 insertions, 0 deletions
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);