From 60d8369a1afaba4efdd64688e4157bc4b48b7525 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Fri, 12 Mar 2010 17:39:27 -0500 Subject: [PATCH] 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 --- clutter/cogl/cogl/cogl-util.c | 1 + 1 file changed, 1 insertion(+) diff --git a/clutter/cogl/cogl/cogl-util.c b/clutter/cogl/cogl/cogl-util.c index 88d17c06e..622b78505 100644 --- a/clutter/cogl/cogl/cogl-util.c +++ b/clutter/cogl/cogl/cogl-util.c @@ -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) {