cogl/object: add cogl_clear_object utility function
This is based on `g_clear_object`, so it will be a bit more consistent to write (and prevents the headaches from accidentally forgetting a NULL check).
This commit is contained in:
parent
63a6ead7d9
commit
081842bac6
@ -75,6 +75,20 @@ cogl_object_ref (void *object);
|
|||||||
void
|
void
|
||||||
cogl_object_unref (void *object);
|
cogl_object_unref (void *object);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* cogl_clear_object: (skip)
|
||||||
|
* @object_ptr: a pointer to a #CoglObject reference
|
||||||
|
*
|
||||||
|
* Clears a reference to a #CoglObject.
|
||||||
|
*
|
||||||
|
* @object_ptr must not be %NULL.
|
||||||
|
*
|
||||||
|
* If the reference is %NULL then this function does nothing.
|
||||||
|
* Otherwise, the reference count of the object is decreased using
|
||||||
|
* cogl_object_unref() and the pointer is set to %NULL.
|
||||||
|
*/
|
||||||
|
#define cogl_clear_object(object_ptr) g_clear_pointer ((object_ptr), cogl_object_unref)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CoglUserDataKey:
|
* CoglUserDataKey:
|
||||||
* @unused: ignored.
|
* @unused: ignored.
|
||||||
|
Loading…
Reference in New Issue
Block a user