screen: Destroy window actors after windows while unmanaging compositor

After commit 2e64457f4 we destroy window actors as part of compositor
destruction, however this might emit 'actor-removed' signals on window groups
that the shell could use to access to resources that are already free'd at this
point (like the destroyed screen, in gnome-shell's Panel._updateSolidStyle()).

So, move the actor destructions under in a new function and destroy the window
actors as part of compositor unmanage step, just after that all the windows are
unmanaged (as they need to have an actor around).

Fixes https://gitlab.gnome.org/GNOME/mutter/issues/652
This commit is contained in:
Marco Trevisan (Treviño) 2019-06-25 20:22:23 +02:00 committed by Marco Trevisan
parent 0276630671
commit 0ca9d88926
3 changed files with 22 additions and 13 deletions

View File

@ -73,4 +73,6 @@ MetaCloseDialog * meta_compositor_create_close_dialog (MetaCompositor *composito
MetaInhibitShortcutsDialog * meta_compositor_create_inhibit_shortcuts_dialog (MetaCompositor *compositor, MetaInhibitShortcutsDialog * meta_compositor_create_inhibit_shortcuts_dialog (MetaCompositor *compositor,
MetaWindow *window); MetaWindow *window);
void meta_compositor_unmanage_window_actors (MetaCompositor *compositor);
#endif /* META_COMPOSITOR_PRIVATE_H */ #endif /* META_COMPOSITOR_PRIVATE_H */

View File

@ -145,19 +145,6 @@ meta_compositor_destroy (MetaCompositor *compositor)
clutter_threads_remove_repaint_func (compositor->pre_paint_func_id); clutter_threads_remove_repaint_func (compositor->pre_paint_func_id);
clutter_threads_remove_repaint_func (compositor->post_paint_func_id); clutter_threads_remove_repaint_func (compositor->post_paint_func_id);
if (compositor->top_window_actor)
{
g_signal_handlers_disconnect_by_func (compositor->top_window_actor,
on_top_window_actor_destroyed,
compositor);
compositor->top_window_actor = NULL;
}
g_clear_pointer (&compositor->window_group, clutter_actor_destroy);
g_clear_pointer (&compositor->top_window_group, clutter_actor_destroy);
g_clear_pointer (&compositor->feedback_group, clutter_actor_destroy);
g_clear_pointer (&compositor->windows, g_list_free);
if (compositor->have_x11_sync_object) if (compositor->have_x11_sync_object)
meta_sync_ring_destroy (); meta_sync_ring_destroy ();
} }
@ -610,6 +597,23 @@ meta_compositor_unmanage (MetaCompositor *compositor)
} }
} }
void
meta_compositor_unmanage_window_actors (MetaCompositor *compositor)
{
if (compositor->top_window_actor)
{
g_signal_handlers_disconnect_by_func (compositor->top_window_actor,
on_top_window_actor_destroyed,
compositor);
compositor->top_window_actor = NULL;
}
g_clear_pointer (&compositor->window_group, clutter_actor_destroy);
g_clear_pointer (&compositor->top_window_group, clutter_actor_destroy);
g_clear_pointer (&compositor->feedback_group, clutter_actor_destroy);
g_clear_pointer (&compositor->windows, g_list_free);
}
/** /**
* meta_shape_cow_for_window: * meta_shape_cow_for_window:
* @compositor: A #MetaCompositor * @compositor: A #MetaCompositor

View File

@ -41,6 +41,7 @@
#include "stack.h" #include "stack.h"
#include <meta/compositor.h> #include <meta/compositor.h>
#include <meta/meta-enum-types.h> #include <meta/meta-enum-types.h>
#include "compositor-private.h"
#include "core.h" #include "core.h"
#include "meta-cursor-tracker-private.h" #include "meta-cursor-tracker-private.h"
#include "boxes-private.h" #include "boxes-private.h"
@ -844,6 +845,8 @@ meta_screen_free (MetaScreen *screen,
meta_display_unmanage_windows_for_screen (display, screen, timestamp); meta_display_unmanage_windows_for_screen (display, screen, timestamp);
meta_compositor_unmanage_window_actors (display->compositor);
meta_prefs_remove_listener (prefs_changed_callback, screen); meta_prefs_remove_listener (prefs_changed_callback, screen);
meta_screen_ungrab_keys (screen); meta_screen_ungrab_keys (screen);