summaryrefslogtreecommitdiff
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
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.
-rw-r--r--gdk-pixbuf/ChangeLog6
-rw-r--r--gdk-pixbuf/gdk-pixbuf.c6
2 files changed, 10 insertions, 2 deletions
diff --git a/gdk-pixbuf/ChangeLog b/gdk-pixbuf/ChangeLog
index 90125f1a99..9386fa3c57 100644
--- a/gdk-pixbuf/ChangeLog
+++ b/gdk-pixbuf/ChangeLog
@@ -1,3 +1,9 @@
+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.
+
1999-08-09 Federico Mena Quintero <federico@nuclecu.unam.mx>
* src/io-png.c (image_save): Fixed compiler warnings. Fixed write
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);
}