From 4f9db59bfd813196e49b3d0beae51d2fe84f46ec Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Tue, 16 Nov 2004 02:51:19 +0000 Subject: Be extra careful when locking and handle the case that the module may 2004-11-15 Matthias Clasen * gdk-pixbuf-animation.c: * gdk-pixbuf-loader.c: * gdk-pixbuf-io.c: Be extra careful when locking and handle the case that the module may initialize the thread system. * gdk-pixbuf-io.[hc] (_gdk_pixbuf_lock): Return whether the lock was actually taken. --- gdk-pixbuf/gdk-pixbuf-animation.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'gdk-pixbuf/gdk-pixbuf-animation.c') diff --git a/gdk-pixbuf/gdk-pixbuf-animation.c b/gdk-pixbuf/gdk-pixbuf-animation.c index fa6968c153..56e5864e92 100644 --- a/gdk-pixbuf/gdk-pixbuf-animation.c +++ b/gdk-pixbuf/gdk-pixbuf-animation.c @@ -137,6 +137,7 @@ gdk_pixbuf_animation_new_from_file (const char *filename, guchar buffer [128]; GdkPixbufModule *image_module; gchar *display_name; + gboolean locked; g_return_val_if_fail (filename != NULL, NULL); g_return_val_if_fail (error == NULL || *error == NULL, NULL); @@ -181,7 +182,7 @@ gdk_pixbuf_animation_new_from_file (const char *filename, return NULL; } - _gdk_pixbuf_lock (image_module); + locked = _gdk_pixbuf_lock (image_module); if (image_module->load_animation == NULL) { GdkPixbuf *pixbuf; @@ -245,7 +246,8 @@ gdk_pixbuf_animation_new_from_file (const char *filename, g_free (display_name); out_unlock: - _gdk_pixbuf_unlock (image_module); + if (locked) + _gdk_pixbuf_unlock (image_module); return animation; } -- cgit v1.2.1