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 committed by Georges Basile Stavracas Neto
parent d7bdaeeb82
commit 4c48c859ea

View File

@ -737,9 +737,8 @@ destroy (MetaPlugin *plugin, MetaWindowActor *window_actor)
* Tile preview private data accessor
*/
static void
free_display_tile_preview (gpointer data)
free_display_tile_preview (DisplayTilePreview *preview)
{
DisplayTilePreview *preview = data;
if (G_LIKELY (preview != NULL)) {
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 *
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_add_child (meta_get_window_group_for_display (display), preview->actor);
g_object_set_qdata_full (G_OBJECT (display),
display_tile_preview_data_quark, preview,
free_display_tile_preview);
g_signal_connect (display,
"closing",
G_CALLBACK (on_display_closing),
preview);
g_object_set_qdata (G_OBJECT (display),
display_tile_preview_data_quark,
preview);
}
return preview;