From 81d579aca07fc6c24bf61d45d498321fc4c0ac82 Mon Sep 17 00:00:00 2001 From: Colin Walters <walters@verbum.org> Date: Tue, 20 Oct 2009 17:43:51 -0400 Subject: [PATCH] Disconnect from window signal handlers when removing a window We need to remove all of our signal handlers attached to a window when being disposed. https://bugzilla.gnome.org/show_bug.cgi?id=598502 --- src/shell-app.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/shell-app.c b/src/shell-app.c index ac0cf5692..e89fcbee5 100644 --- a/src/shell-app.c +++ b/src/shell-app.c @@ -324,8 +324,11 @@ void _shell_app_remove_window (ShellApp *app, MetaWindow *window) { + g_signal_handlers_disconnect_by_func (window, G_CALLBACK(shell_app_on_unmanaged), app); + g_signal_handlers_disconnect_by_func (window, G_CALLBACK(shell_app_on_user_time_changed), app); g_object_unref (window); app->windows = g_slist_remove (app->windows, window); + if (app->windows == NULL) disconnect_workspace_switch (app); } @@ -346,12 +349,8 @@ shell_app_dispose (GObject *object) app->info = NULL; } - if (app->windows) - { - g_slist_foreach (app->windows, (GFunc) g_object_unref, NULL); - g_slist_free (app->windows); - app->windows = NULL; - } + while (app->windows) + _shell_app_remove_window (app, app->windows->data); disconnect_workspace_switch (app); }