mirror of
https://github.com/brl/mutter.git
synced 2025-01-22 17:38:56 +00:00
object: avoid creating a new entry for NULL data
If setting NULL user data via cogl_object_set_user_data() and we fail to find an entry for the given key then bail out before potentially allocating a new entry since setting NULL data is documented to effectively delete an entry. Reviewed-by: Neil Roberts <neil@linux.intel.com>
This commit is contained in:
parent
31097c0488
commit
ed06d0ca01
@ -190,6 +190,12 @@ _cogl_object_set_user_data (CoglObject *object,
|
||||
}
|
||||
else
|
||||
{
|
||||
/* NB: Setting a value of NULL is documented to delete the
|
||||
* corresponding entry so we can return immediately in this
|
||||
* case. */
|
||||
if (user_data == NULL)
|
||||
return;
|
||||
|
||||
if (G_LIKELY (object->n_user_data_entries <
|
||||
COGL_OBJECT_N_PRE_ALLOCATED_USER_DATA_ENTRIES))
|
||||
entry = &object->user_data_entry[object->n_user_data_entries++];
|
||||
|
Loading…
x
Reference in New Issue
Block a user