diff --git a/src/compositor/plugins/default.c b/src/compositor/plugins/default.c index 42d28ec20..378009006 100644 --- a/src/compositor/plugins/default.c +++ b/src/compositor/plugins/default.c @@ -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;