summaryrefslogtreecommitdiff
path: root/gdk-pixbuf/gdk-pixbuf-loader.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2006-12-10 04:25:46 +0000
committerMatthias Clasen <matthiasc@src.gnome.org>2006-12-10 04:25:46 +0000
commitb8756357f335807ff5511547b7b65a3d8a4fba7e (patch)
tree0331e95572d869672c47d211fb559c06b718b37d /gdk-pixbuf/gdk-pixbuf-loader.c
parent4719b375cfc628943695ce4da6eb93f8ba1fc4cb (diff)
downloadgtk+-b8756357f335807ff5511547b7b65a3d8a4fba7e.tar.gz
Behave as documented and close the loader when returning FALSE.
2006-12-09 Matthias Clasen <mclasen@redhat.com> * gdk-pixbuf-loader.c (gdk_pixbuf_loader_write): Behave as documented and close the loader when returning FALSE.
Diffstat (limited to 'gdk-pixbuf/gdk-pixbuf-loader.c')
-rw-r--r--gdk-pixbuf/gdk-pixbuf-loader.c28
1 files changed, 17 insertions, 11 deletions
diff --git a/gdk-pixbuf/gdk-pixbuf-loader.c b/gdk-pixbuf/gdk-pixbuf-loader.c
index b03f06e83e..977d8de23c 100644
--- a/gdk-pixbuf/gdk-pixbuf-loader.c
+++ b/gdk-pixbuf/gdk-pixbuf-loader.c
@@ -455,10 +455,7 @@ gdk_pixbuf_loader_write (GdkPixbufLoader *loader,
eaten = gdk_pixbuf_loader_eat_header_write (loader, buf, count, error);
if (eaten <= 0)
- {
- gdk_pixbuf_loader_ensure_error (loader, error);
- return FALSE;
- }
+ goto fail;
count -= eaten;
buf += eaten;
@@ -466,16 +463,25 @@ gdk_pixbuf_loader_write (GdkPixbufLoader *loader,
if (count > 0 && priv->image_module->load_increment)
{
- gboolean retval;
- retval = priv->image_module->load_increment (priv->context, buf, count,
- error);
- if (!retval)
- gdk_pixbuf_loader_ensure_error (loader, error);
-
- return retval;
+ if (!priv->image_module->load_increment (priv->context, buf, count,
+ error))
+ goto fail;
}
return TRUE;
+
+ fail:
+ gdk_pixbuf_loader_ensure_error (loader, error);
+
+ priv->closed = TRUE;
+
+ if (priv->image_module && priv->holds_threadlock)
+ {
+ _gdk_pixbuf_unlock (priv->image_module);
+ priv->holds_threadlock = FALSE;
+ }
+
+ return FALSE;
}
/**