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
This commit is contained in:
Colin Walters 2009-10-20 17:43:51 -04:00
parent 7548f2d71e
commit 81d579aca0

View File

@ -324,8 +324,11 @@ void
_shell_app_remove_window (ShellApp *app, _shell_app_remove_window (ShellApp *app,
MetaWindow *window) 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); g_object_unref (window);
app->windows = g_slist_remove (app->windows, window); app->windows = g_slist_remove (app->windows, window);
if (app->windows == NULL) if (app->windows == NULL)
disconnect_workspace_switch (app); disconnect_workspace_switch (app);
} }
@ -346,12 +349,8 @@ shell_app_dispose (GObject *object)
app->info = NULL; app->info = NULL;
} }
if (app->windows) while (app->windows)
{ _shell_app_remove_window (app, app->windows->data);
g_slist_foreach (app->windows, (GFunc) g_object_unref, NULL);
g_slist_free (app->windows);
app->windows = NULL;
}
disconnect_workspace_switch (app); disconnect_workspace_switch (app);
} }