diff options
| author | Victor Kareh <[email protected]> | 2025-11-21 17:38:44 -0500 |
|---|---|---|
| committer | Victor Kareh <[email protected]> | 2025-11-21 17:38:44 -0500 |
| commit | cb82879bd20fb108b887f2291d0b3dbcbe915248 (patch) | |
| tree | 5e76ad2490bb3c2063e580449cddd4bb0344edeb | |
| parent | 83c2a901d8ce083822e3caccb750d7d22c031e9a (diff) | |
| download | mate-notification-daemon-idle-preserve-history.tar.bz2 mate-notification-daemon-idle-preserve-history.tar.xz | |
daemon: Fix idle reposition source removal warningidle-preserve-history
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.
| -rw-r--r-- | src/daemon/daemon.c | 13 |
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); |
