renderer: Switch open coded list clearing to g_clear_list()

The same for MetaRendererNative.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1820>
This commit is contained in:
Jonas Ådahl 2021-04-10 00:49:51 +02:00 committed by Marge Bot
parent 1a7f4d49f3
commit dc35514fb4
2 changed files with 10 additions and 17 deletions

View File

@ -143,8 +143,7 @@ meta_renderer_real_rebuild_views (MetaRenderer *renderer)
meta_backend_get_monitor_manager (backend); meta_backend_get_monitor_manager (backend);
GList *logical_monitors, *l; GList *logical_monitors, *l;
g_list_free_full (priv->views, (GDestroyNotify) clutter_stage_view_destroy); g_clear_list (&priv->views, (GDestroyNotify) clutter_stage_view_destroy);
priv->views = NULL;
logical_monitors = logical_monitors =
meta_monitor_manager_get_logical_monitors (monitor_manager); meta_monitor_manager_get_logical_monitors (monitor_manager);
@ -372,8 +371,7 @@ meta_renderer_finalize (GObject *object)
MetaRenderer *renderer = META_RENDERER (object); MetaRenderer *renderer = META_RENDERER (object);
MetaRendererPrivate *priv = meta_renderer_get_instance_private (renderer); MetaRendererPrivate *priv = meta_renderer_get_instance_private (renderer);
g_list_free_full (priv->views, g_object_unref); g_clear_list (&priv->views, g_object_unref);
priv->views = NULL;
G_OBJECT_CLASS (meta_renderer_parent_class)->finalize (object); G_OBJECT_CLASS (meta_renderer_parent_class)->finalize (object);
} }

View File

@ -587,9 +587,8 @@ dummy_power_save_page_flip_cb (gpointer user_data)
g_list_foreach (renderer_native->power_save_page_flip_onscreens, g_list_foreach (renderer_native->power_save_page_flip_onscreens,
(GFunc) meta_onscreen_native_dummy_power_save_page_flip, (GFunc) meta_onscreen_native_dummy_power_save_page_flip,
NULL); NULL);
g_list_free_full (renderer_native->power_save_page_flip_onscreens, g_clear_list (&renderer_native->power_save_page_flip_onscreens,
g_object_unref); g_object_unref);
renderer_native->power_save_page_flip_onscreens = NULL;
renderer_native->power_save_page_flip_source_id = 0; renderer_native->power_save_page_flip_source_id = 0;
return G_SOURCE_REMOVE; return G_SOURCE_REMOVE;
@ -617,9 +616,8 @@ meta_renderer_native_queue_power_save_page_flip (MetaRendererNative *renderer_na
static void static void
clear_kept_alive_onscreens (MetaRendererNative *renderer_native) clear_kept_alive_onscreens (MetaRendererNative *renderer_native)
{ {
g_list_free_full (renderer_native->kept_alive_onscreens, g_clear_list (&renderer_native->kept_alive_onscreens,
g_object_unref); g_object_unref);
renderer_native->kept_alive_onscreens = NULL;
} }
void void
@ -2037,13 +2035,10 @@ meta_renderer_native_finalize (GObject *object)
clear_kept_alive_onscreens (renderer_native); clear_kept_alive_onscreens (renderer_native);
if (renderer_native->power_save_page_flip_onscreens) g_clear_list (&renderer_native->power_save_page_flip_onscreens,
{
g_list_free_full (renderer_native->power_save_page_flip_onscreens,
g_object_unref); g_object_unref);
g_clear_handle_id (&renderer_native->power_save_page_flip_source_id, g_clear_handle_id (&renderer_native->power_save_page_flip_source_id,
g_source_remove); g_source_remove);
}
g_list_free (renderer_native->pending_mode_set_views); g_list_free (renderer_native->pending_mode_set_views);