Set the initial ref_count to 1.

1999-09-17  Federico Mena Quintero  <federico@redhat.com>

	* 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.
This commit is contained in:
Federico Mena Quintero 1999-09-17 07:57:25 +00:00 committed by Arturo Espinosa
parent 6fce115b98
commit 66779b9b26
8 changed files with 22 additions and 6 deletions

View File

@ -1,5 +1,20 @@
1999-09-17 Federico Mena Quintero <federico@redhat.com>
* 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.

View File

@ -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;
}
}

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -417,7 +417,7 @@ static GdkPixBuf *
return NULL;
}
pixbuf->ref_count = 0;
pixbuf->ref_count = 1;
pixbuf->unref_func = NULL;
return pixbuf;