1
0
Fork 0

wayland/transaction: Check surface pointer validity in _ensure_entry

If a caller passes in NULL or a non-NULL value which doesn't point to
a valid MetaWaylandSurface object, this will hopefully point in the
direction of the cause.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3725>
This commit is contained in:
Michel Dänzer 2024-04-30 15:43:38 +02:00 committed by Sebastian Wick
parent b67f94ca7e
commit dd32f3b3be

View file

@ -485,8 +485,12 @@ meta_wayland_transaction_ensure_entry (MetaWaylandTransaction *transaction,
if (entry) if (entry)
return entry; return entry;
g_return_val_if_fail (surface, NULL);
surface = g_object_ref (surface);
g_return_val_if_fail (surface, NULL);
entry = g_new0 (MetaWaylandTransactionEntry, 1); entry = g_new0 (MetaWaylandTransactionEntry, 1);
g_hash_table_insert (transaction->entries, g_object_ref (surface), entry); g_hash_table_insert (transaction->entries, surface, entry);
return entry; return entry;
} }