Return and warn if a handle's refcount is <= 0

This makes it more likely consumers notice invalid unreferences.
GObject has the same assertion.

http://bugzilla.openedhand.com/show_bug.cgi?id=2029

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
This commit is contained in:
Colin Walters 2010-03-12 17:39:27 -05:00 committed by Emmanuele Bassi
parent 9fc9aa562e
commit 89519a1d33

View File

@ -78,6 +78,7 @@ cogl_handle_unref (CoglHandle handle)
CoglHandleObject *obj = (CoglHandleObject *)handle;
g_return_if_fail (handle != COGL_INVALID_HANDLE);
g_return_if_fail (obj->ref_count > 0);
if (--obj->ref_count < 1)
{