[mutter] default-plugin: Kill workspace switch animation on shutdown



commit bc6af4f1c84d83515d1b0cd4af1822fbfda9938d
Author: Sebastian Wick <sebastian wick redhat com>
Date:   Sat Jul 9 12:08:48 2022 +0200

    default-plugin: Kill workspace switch animation on shutdown
    
    The workspace switch animation moves the WindowActors out of the
    WindowGroup so if we shut down while the animation is playing the
    WindowActors will have queued a destroy but will be disposed only after
    the compositor is destroyed, leaving the WindowActor with a dangling
    pointer.
    
    Fix the issue by killing the workspace switch animation on shutdown.
    
    Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2489>

 src/compositor/plugins/default.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
---
diff --git a/src/compositor/plugins/default.c b/src/compositor/plugins/default.c
index 5240e17119..45d88b8621 100644
--- a/src/compositor/plugins/default.c
+++ b/src/compositor/plugins/default.c
@@ -470,12 +470,20 @@ init_keymap (MetaDefaultPlugin *self)
                            x11_layout, x11_variant, x11_options);
 }
 
+static void
+prepare_shutdown (MetaBackend       *backend,
+                  MetaDefaultPlugin *plugin)
+{
+  kill_switch_workspace (META_PLUGIN (plugin));
+}
+
 static void
 start (MetaPlugin *plugin)
 {
   MetaDefaultPlugin *self = META_DEFAULT_PLUGIN (plugin);
   MetaDisplay *display = meta_plugin_get_display (plugin);
   MetaMonitorManager *monitor_manager = meta_monitor_manager_get ();
+  MetaBackend *backend = meta_get_backend ();
 
   self->priv->background_group = meta_background_group_new ();
   clutter_actor_insert_child_below (meta_get_window_group_for_display (display),
@@ -486,6 +494,10 @@ start (MetaPlugin *plugin)
 
   on_monitors_changed (monitor_manager, plugin);
 
+  g_signal_connect (backend, "prepare-shutdown",
+                    G_CALLBACK (prepare_shutdown),
+                    self);
+
   if (meta_is_wayland_compositor ())
     init_keymap (self);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]