diff --git a/src/shell-app.c b/src/shell-app.c index 28e819a05..587b4a4ed 100644 --- a/src/shell-app.c +++ b/src/shell-app.c @@ -1140,6 +1140,13 @@ _shell_app_remove_window (ShellApp *app, app->running_state->windows = g_slist_remove (app->running_state->windows, window); + if (!meta_window_is_skip_taskbar (window)) + app->running_state->interesting_windows--; + shell_app_sync_running_state (app); + + if (app->running_state->windows == NULL) + g_clear_pointer (&app->running_state, unref_running_state); + g_signal_handlers_disconnect_by_func (window, G_CALLBACK(shell_app_on_user_time_changed), app); g_signal_handlers_disconnect_by_func (window, G_CALLBACK(shell_app_on_skip_taskbar_changed), app); if (window == app->fallback_icon_window) @@ -1152,15 +1159,8 @@ _shell_app_remove_window (ShellApp *app, g_object_notify (G_OBJECT (app), "icon"); } - if (!meta_window_is_skip_taskbar (window)) - app->running_state->interesting_windows--; - shell_app_sync_running_state (app); - g_object_unref (window); - if (app->running_state->windows == NULL) - g_clear_pointer (&app->running_state, unref_running_state); - g_signal_emit (app, shell_app_signals[WINDOWS_CHANGED], 0); }