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 c274118a8f
commit 60d8369a1a

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)
{