From 5493a2373b76e9eee14662a41a16ebb7615be6da Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Thu, 3 Sep 2009 16:34:07 -0400 Subject: Fix a reference counting issue in EShellTaskbar. --- shell/e-shell-taskbar.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'shell') diff --git a/shell/e-shell-taskbar.c b/shell/e-shell-taskbar.c index 61f27fbc79..c3d89d7023 100644 --- a/shell/e-shell-taskbar.c +++ b/shell/e-shell-taskbar.c @@ -33,6 +33,10 @@ struct _EShellTaskbarPrivate { gpointer shell_view; /* weak pointer */ + /* Keep a reference to the shell backend since + * we connect to its "activity-added" signal. */ + EShellBackend *shell_backend; + GtkWidget *label; GtkWidget *hbox; @@ -166,6 +170,14 @@ shell_taskbar_dispose (GObject *object) priv->shell_view = NULL; } + if (priv->shell_backend != NULL) { + g_signal_handlers_disconnect_matched ( + priv->shell_backend, G_SIGNAL_MATCH_DATA, + 0, 0, NULL, NULL, object); + g_object_unref (priv->shell_backend); + priv->shell_backend = NULL; + } + if (priv->label != NULL) { g_object_unref (priv->label); priv->label = NULL; @@ -206,6 +218,10 @@ shell_taskbar_constructed (GObject *object) shell_view = e_shell_taskbar_get_shell_view (shell_taskbar); shell_backend = e_shell_view_get_shell_backend (shell_view); + /* Keep a reference to the shell backend so we can + * disconnect the signal handler during dispose(). */ + shell_taskbar->priv->shell_backend = g_object_ref (shell_backend); + g_signal_connect_swapped ( shell_backend, "activity-added", G_CALLBACK (shell_taskbar_activity_add), shell_taskbar); -- cgit