From 14cb9e710a984ae3b83f203c0fbc4f362ebf341e Mon Sep 17 00:00:00 2001 From: Michael Fulbright Date: Wed, 27 Oct 1999 16:41:44 +0000 Subject: [PATCH] gdk-pixbuf-loader.c: Fixed init function to properly initialize all structure members. testpixbuf.c: Added call to close and destroy pixbuf loader properly. --- demos/testpixbuf.c | 29 ++++++++++++++++------------- gdk-pixbuf/gdk-pixbuf-loader.c | 1 + gtk/gdk-pixbuf-loader.c | 1 + 3 files changed, 18 insertions(+), 13 deletions(-) diff --git a/demos/testpixbuf.c b/demos/testpixbuf.c index 35c93167d2..20dc5f79a6 100644 --- a/demos/testpixbuf.c +++ b/demos/testpixbuf.c @@ -452,21 +452,24 @@ main (int argc, char **argv) found_valid = TRUE; } } - } - pixbuf_loader = gdk_pixbuf_loader_new (); - file = fopen ("/usr/share/pixmaps/up2date.png", "r"); - g_assert (file != NULL); - - while (TRUE) { - val = fgetc (file); - if (val == EOF) - break; - buf = (guint) val; - if (gdk_pixbuf_loader_write (GDK_PIXBUF_LOADER (pixbuf_loader), &buf, 1) == FALSE) - break; + pixbuf_loader = gdk_pixbuf_loader_new (); + file = fopen (argv[1], "r"); + g_assert (file != NULL); + + while (TRUE) { + val = fgetc (file); + if (val == EOF) + break; + buf = (guint) val; + if (gdk_pixbuf_loader_write (GDK_PIXBUF_LOADER (pixbuf_loader), &buf, 1) == FALSE) + break; + } + gdk_pixbuf_loader_close (GDK_PIXBUF_LOADER (pixbuf_loader)); + gtk_object_destroy (pixbuf_loader); + fclose (file); + } - fclose (file); if (found_valid) gtk_main (); diff --git a/gdk-pixbuf/gdk-pixbuf-loader.c b/gdk-pixbuf/gdk-pixbuf-loader.c index ecb1b071f8..efc132d265 100644 --- a/gdk-pixbuf/gdk-pixbuf-loader.c +++ b/gdk-pixbuf/gdk-pixbuf-loader.c @@ -145,6 +145,7 @@ gdk_pixbuf_loader_init (GdkPixbufLoader *loader) priv = g_new (GdkPixbufLoaderPrivate, 1); loader->private = priv; + priv->image_module=NULL; priv->pixbuf = NULL; priv->closed = FALSE; priv->buf_offset = 0; diff --git a/gtk/gdk-pixbuf-loader.c b/gtk/gdk-pixbuf-loader.c index ecb1b071f8..efc132d265 100644 --- a/gtk/gdk-pixbuf-loader.c +++ b/gtk/gdk-pixbuf-loader.c @@ -145,6 +145,7 @@ gdk_pixbuf_loader_init (GdkPixbufLoader *loader) priv = g_new (GdkPixbufLoaderPrivate, 1); loader->private = priv; + priv->image_module=NULL; priv->pixbuf = NULL; priv->closed = FALSE; priv->buf_offset = 0;