diff --git a/gdk-pixbuf/ChangeLog b/gdk-pixbuf/ChangeLog index 9386fa3c57..a7c48604c6 100644 --- a/gdk-pixbuf/ChangeLog +++ b/gdk-pixbuf/ChangeLog @@ -1,5 +1,20 @@ 1999-09-17 Federico Mena Quintero + * src/io-bmp.c (image_load): Set the initial ref_count to 1. + + * src/io-gif.c (image_load): Likewise. + + * src/io-jpeg.c (image_load): Likewise. + + * src/io-png.c (image_load): Likewise. + + * src/io-tiff.c (image_load): Likewise. + + * src/io-xpm.c (_pixbuf_create_from_xpm): Likewise. + + * src/gdk-pixbuf-io.c (gdk_pixbuf_load_image): Added an assertion + for the ref_count to be != 0. + * src/gdk-pixbuf.c (gdk_pixbuf_ref): Be more paranoid with sanity checking. (gdk_pixbuf_unref): Fix incorrect sanity check and comparison. diff --git a/gdk-pixbuf/gdk-pixbuf-io.c b/gdk-pixbuf/gdk-pixbuf-io.c index 7b644000eb..72d611dbdd 100644 --- a/gdk-pixbuf/gdk-pixbuf-io.c +++ b/gdk-pixbuf/gdk-pixbuf-io.c @@ -194,6 +194,7 @@ gdk_pixbuf_load_image (const char *file) fseek(f, 0, SEEK_SET); pixbuf = (*file_formats [i].load)(f); fclose (f); + g_assert (pixbuf->ref_count != 0); return pixbuf; } } diff --git a/gdk-pixbuf/io-bmp.c b/gdk-pixbuf/io-bmp.c index 6195599548..503747bcb1 100644 --- a/gdk-pixbuf/io-bmp.c +++ b/gdk-pixbuf/io-bmp.c @@ -47,7 +47,7 @@ GdkPixBuf *image_load(FILE * f) /* Ok, I'm anal...shoot me */ if (!(pixbuf->art_pixbuf)) return NULL; - pixbuf->ref_count = 0; + pixbuf->ref_count = 1; pixbuf->unref_func = NULL; return pixbuf; diff --git a/gdk-pixbuf/io-gif.c b/gdk-pixbuf/io-gif.c index 926964f39d..2fb964b66a 100644 --- a/gdk-pixbuf/io-gif.c +++ b/gdk-pixbuf/io-gif.c @@ -174,7 +174,7 @@ GdkPixBuf *image_load(FILE * f) return NULL; } - pixbuf->ref_count = 0; + pixbuf->ref_count = 1; pixbuf->unref_func = NULL; return pixbuf; diff --git a/gdk-pixbuf/io-jpeg.c b/gdk-pixbuf/io-jpeg.c index 8e2a830bdd..afe5baee82 100644 --- a/gdk-pixbuf/io-jpeg.c +++ b/gdk-pixbuf/io-jpeg.c @@ -121,7 +121,7 @@ GdkPixBuf *image_load(FILE *f) g_free(pixbuf); return NULL; } - pixbuf->ref_count = 0; + pixbuf->ref_count = 1; pixbuf->unref_func = NULL; return pixbuf; diff --git a/gdk-pixbuf/io-png.c b/gdk-pixbuf/io-png.c index 9746ed21c7..1f86600f54 100644 --- a/gdk-pixbuf/io-png.c +++ b/gdk-pixbuf/io-png.c @@ -158,7 +158,7 @@ GdkPixBuf *image_load(FILE * f) return NULL; } - pixbuf->ref_count = 0; + pixbuf->ref_count = 1; pixbuf->unref_func = NULL; return pixbuf; diff --git a/gdk-pixbuf/io-tiff.c b/gdk-pixbuf/io-tiff.c index 771a052674..dffe9ef257 100644 --- a/gdk-pixbuf/io-tiff.c +++ b/gdk-pixbuf/io-tiff.c @@ -94,7 +94,7 @@ GdkPixBuf *image_load(FILE * f) /* Ok, I'm anal...shoot me */ if (!(pixbuf->art_pixbuf)) return NULL; - pixbuf->ref_count = 0; + pixbuf->ref_count = 1; pixbuf->unref_func = NULL; return pixbuf; diff --git a/gdk-pixbuf/io-xpm.c b/gdk-pixbuf/io-xpm.c index b97fca2f11..db78f1d931 100644 --- a/gdk-pixbuf/io-xpm.c +++ b/gdk-pixbuf/io-xpm.c @@ -417,7 +417,7 @@ static GdkPixBuf * return NULL; } - pixbuf->ref_count = 0; + pixbuf->ref_count = 1; pixbuf->unref_func = NULL; return pixbuf;