kms/impl-device/atomic: Discard pending page flip datas on finalize

This is so page flip listeners can clean up any references attached to a
page flip.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1822>
This commit is contained in:
Jonas Ådahl 2021-04-11 01:39:54 +02:00 committed by Marge Bot
parent 7c924a562f
commit 1af874fca6

View File

@ -999,12 +999,28 @@ meta_kms_impl_device_atomic_discard_pending_page_flips (MetaKmsImplDevice *impl_
{ {
} }
static gboolean
dispose_page_flip_data (gpointer key,
gpointer value,
gpointer user_data)
{
MetaKmsPageFlipData *page_flip_data = value;
meta_kms_page_flip_data_discard_in_impl (page_flip_data, NULL);
return TRUE;
}
static void static void
meta_kms_impl_device_atomic_finalize (GObject *object) meta_kms_impl_device_atomic_finalize (GObject *object)
{ {
MetaKmsImplDeviceAtomic *impl_device_atomic = MetaKmsImplDeviceAtomic *impl_device_atomic =
META_KMS_IMPL_DEVICE_ATOMIC (object); META_KMS_IMPL_DEVICE_ATOMIC (object);
g_hash_table_foreach_remove (impl_device_atomic->page_flip_datas,
dispose_page_flip_data,
NULL);
g_hash_table_unref (impl_device_atomic->page_flip_datas); g_hash_table_unref (impl_device_atomic->page_flip_datas);
G_OBJECT_CLASS (meta_kms_impl_device_atomic_parent_class)->finalize (object); G_OBJECT_CLASS (meta_kms_impl_device_atomic_parent_class)->finalize (object);