1
0
Fork 0

renderer/native: Steal the power save flip list before iterating over it

Because a single iteration might also grow the list again.

Signed-off-by: Mingi Sung <sungmg@saltyming.net>
This commit is contained in:
Daniel van Vugt 2021-11-01 19:35:34 +08:00 committed by Mingi Sung
parent 19ffbaaa2a
commit e5374ba456
Signed by: sungmg
GPG key ID: 41BAFD6FFD8036C5

View file

@ -731,12 +731,18 @@ static gboolean
dummy_power_save_page_flip_cb (gpointer user_data)
{
MetaRendererNative *renderer_native = user_data;
GList *old_list =
g_steal_pointer (&renderer_native->power_save_page_flip_onscreens);
g_list_foreach (renderer_native->power_save_page_flip_onscreens,
g_list_foreach (old_list,
(GFunc) meta_onscreen_native_dummy_power_save_page_flip,
NULL);
g_clear_list (&renderer_native->power_save_page_flip_onscreens,
g_clear_list (&old_list,
g_object_unref);
if (renderer_native->power_save_page_flip_onscreens != NULL)
return G_SOURCE_CONTINUE;
renderer_native->power_save_page_flip_source_id = 0;
return G_SOURCE_REMOVE;