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.
This commit is contained in:
Matthias Clasen 2006-12-10 04:25:46 +00:00 committed by Matthias Clasen
parent 4719b375cf
commit b8756357f3
2 changed files with 22 additions and 11 deletions

View File

@ -1,3 +1,8 @@
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.
2006-10-29 Tor Lillqvist <tml@novell.com> 2006-10-29 Tor Lillqvist <tml@novell.com>
* pixbufloader_*.def * pixbufloader_*.def

View File

@ -455,10 +455,7 @@ gdk_pixbuf_loader_write (GdkPixbufLoader *loader,
eaten = gdk_pixbuf_loader_eat_header_write (loader, buf, count, error); eaten = gdk_pixbuf_loader_eat_header_write (loader, buf, count, error);
if (eaten <= 0) if (eaten <= 0)
{ goto fail;
gdk_pixbuf_loader_ensure_error (loader, error);
return FALSE;
}
count -= eaten; count -= eaten;
buf += eaten; buf += eaten;
@ -466,16 +463,25 @@ gdk_pixbuf_loader_write (GdkPixbufLoader *loader,
if (count > 0 && priv->image_module->load_increment) if (count > 0 && priv->image_module->load_increment)
{ {
gboolean retval; if (!priv->image_module->load_increment (priv->context, buf, count,
retval = priv->image_module->load_increment (priv->context, buf, count, error))
error); goto fail;
if (!retval)
gdk_pixbuf_loader_ensure_error (loader, error);
return retval;
} }
return TRUE; 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;
} }
/** /**