plugins/default: Clean up tile preview when closing display

On finalize, the preview actor will have been destroyed behind our back;
avoid that by cleaning up before it's too late.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/912
This commit is contained in:
Jonas Ådahl 2019-11-01 13:16:25 +01:00
parent 955b27637c
commit dc1a28c42a

View File

@ -737,9 +737,8 @@ destroy (MetaPlugin *plugin, MetaWindowActor *window_actor)
* Tile preview private data accessor * Tile preview private data accessor
*/ */
static void static void
free_display_tile_preview (gpointer data) free_display_tile_preview (DisplayTilePreview *preview)
{ {
DisplayTilePreview *preview = data;
if (G_LIKELY (preview != NULL)) { if (G_LIKELY (preview != NULL)) {
clutter_actor_destroy (preview->actor); clutter_actor_destroy (preview->actor);
@ -747,6 +746,13 @@ free_display_tile_preview (gpointer data)
} }
} }
static void
on_display_closing (MetaDisplay *display,
DisplayTilePreview *preview)
{
free_display_tile_preview (preview);
}
static DisplayTilePreview * static DisplayTilePreview *
get_display_tile_preview (MetaDisplay *display) get_display_tile_preview (MetaDisplay *display)
{ {
@ -769,9 +775,13 @@ get_display_tile_preview (MetaDisplay *display)
clutter_actor_set_opacity (preview->actor, 100); clutter_actor_set_opacity (preview->actor, 100);
clutter_actor_add_child (meta_get_window_group_for_display (display), preview->actor); clutter_actor_add_child (meta_get_window_group_for_display (display), preview->actor);
g_object_set_qdata_full (G_OBJECT (display), g_signal_connect (display,
display_tile_preview_data_quark, preview, "closing",
free_display_tile_preview); G_CALLBACK (on_display_closing),
preview);
g_object_set_qdata (G_OBJECT (display),
display_tile_preview_data_quark,
preview);
} }
return preview; return preview;