diff --git a/cogl/cogl/cogl-object.h b/cogl/cogl/cogl-object.h index 338ef79d8..91ef5790d 100644 --- a/cogl/cogl/cogl-object.h +++ b/cogl/cogl/cogl-object.h @@ -75,6 +75,20 @@ cogl_object_ref (void *object); void 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: * @unused: ignored.