summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene Kilachkoff <[email protected]>2014-07-02 16:49:17 +0400
committerStefano Karapetsas <[email protected]>2014-10-22 23:36:42 +0200
commit7c7ef60a26de4a1f319abf10cf10606d630fbccc (patch)
tree5a5ac282cb84ac5873e813d91d005dd9f00ac13e
parentdef0c07560909077a32504976d3e3d1b32aa9002 (diff)
downloadmate-notification-daemon-7c7ef60a26de4a1f319abf10cf10606d630fbccc.tar.bz2
mate-notification-daemon-7c7ef60a26de4a1f319abf10cf10606d630fbccc.tar.xz
Fix crash when switching monitors
When switching monitors AND displaying notifications at the same time, a rare situation might occur when notification window will be added to two or more stacks. One of the stacks will be removed soon enough, but the "destroy" handler will persist and will be triggered when the window disappears. This results in a reference to a freed memory and (usually) a daemon crash, a typical one is https://retrace.fedoraproject.org/faf/reports/359836/ for example. So, the removal handlers referring to a deleted stack must be cancelled prior to removal. Closes https://github.com/mate-desktop/mate-notification-daemon/pull/34
-rw-r--r--src/daemon/stack.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/daemon/stack.c b/src/daemon/stack.c
index 0bfcae0..3805900 100644
--- a/src/daemon/stack.c
+++ b/src/daemon/stack.c
@@ -214,12 +214,19 @@ notify_stack_new (NotifyDaemon *daemon,
void
notify_stack_destroy (NotifyStack *stack)
{
+ GList* l;
+
g_assert (stack != NULL);
if (stack->update_id != 0) {
g_source_remove (stack->update_id);
}
+ for (l = stack->windows; l != NULL; l = l->next) {
+ GtkWindow *nw = GTK_WINDOW (l->data);
+ g_signal_handlers_disconnect_by_data(G_OBJECT(nw), stack);
+ }
+
g_list_free (stack->windows);
g_free (stack);
}