diff options
Diffstat (limited to 'gtk/gtkobject.c')
-rw-r--r-- | gtk/gtkobject.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/gtk/gtkobject.c b/gtk/gtkobject.c index 6639830a2..af5676172 100644 --- a/gtk/gtkobject.c +++ b/gtk/gtkobject.c @@ -1033,6 +1033,7 @@ gtk_object_ref (GtkObject *object) { g_return_if_fail (object != NULL); g_return_if_fail (GTK_IS_OBJECT (object)); + g_return_if_fail (object->ref_count > 0); object->ref_count += 1; } @@ -1042,12 +1043,16 @@ gtk_object_unref (GtkObject *object) { g_return_if_fail (object != NULL); g_return_if_fail (GTK_IS_OBJECT (object)); + g_return_if_fail (object->ref_count > 0); if (object->ref_count == 1) - gtk_object_destroy (object); + { + gtk_object_destroy (object); - if (object->ref_count > 0) - object->ref_count -= 1; + g_return_if_fail (object->ref_count > 0); + } + + object->ref_count -= 1; if (object->ref_count == 0) { |