summaryrefslogtreecommitdiff
path: root/gdk-pixbuf/gdk-pixbuf.c
diff options
context:
space:
mode:
authorFederico Mena Quintero <federico@redhat.com>1999-09-17 05:59:53 +0000
committerArturo Espinosa <unammx@src.gnome.org>1999-09-17 05:59:53 +0000
commit6fce115b98578d7b501990e5542c2a8b2048ab3d (patch)
tree223de92ca57710f5ef7ce2d596053b483935aac5 /gdk-pixbuf/gdk-pixbuf.c
parent04f5c2a1e772f3697ac4c4a0851006d4d18cb16d (diff)
downloadgtk+-6fce115b98578d7b501990e5542c2a8b2048ab3d.tar.gz
Be more paranoid with sanity checking. (gdk_pixbuf_unref): Fix incorrect
1999-09-17 Federico Mena Quintero <federico@redhat.com> * src/gdk-pixbuf.c (gdk_pixbuf_ref): Be more paranoid with sanity checking. (gdk_pixbuf_unref): Fix incorrect sanity check and comparison.
Diffstat (limited to 'gdk-pixbuf/gdk-pixbuf.c')
-rw-r--r--gdk-pixbuf/gdk-pixbuf.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/gdk-pixbuf/gdk-pixbuf.c b/gdk-pixbuf/gdk-pixbuf.c
index 82acf793a5..dc23940f20 100644
--- a/gdk-pixbuf/gdk-pixbuf.c
+++ b/gdk-pixbuf/gdk-pixbuf.c
@@ -28,6 +28,7 @@ void
gdk_pixbuf_ref (GdkPixBuf *pixbuf)
{
g_return_if_fail (pixbuf != NULL);
+ g_return_if_fail (pixbuf->ref_count > 0);
pixbuf->ref_count++;
}
@@ -36,10 +37,11 @@ void
gdk_pixbuf_unref (GdkPixBuf *pixbuf)
{
g_return_if_fail (pixbuf != NULL);
- g_return_if_fail (pixbuf->ref_count == 0);
+ g_return_if_fail (pixbuf->ref_count > 0);
pixbuf->ref_count--;
- if (pixbuf->ref_count)
+
+ if (pixbuf->ref_count == 0)
gdk_pixbuf_destroy (pixbuf);
}