[eog] Remove workaround for non-threadsafe pixbuf loaders



commit a9c9d81405e31443ab51713f6a0712f9bb10e11b
Author: Felix Riemann <friemann gnome org>
Date:   Sun May 17 16:13:00 2015 +0200

    Remove workaround for non-threadsafe pixbuf loaders
    
    gdk-pixbuf requires loaders to be threadsafe since 2.28 and the
    workaround shouldn't be needed anymore. That reduces the complexity
    of the image loading code. Require gdk-pixbuf 2.30.0 since that version
    is required by GTK+ already.

 configure.ac            |    2 +-
 src/eog-image-private.h |    1 -
 src/eog-image.c         |   71 ++++-------------------------------------------
 3 files changed, 7 insertions(+), 67 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index c4b0e6e..181eaa9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -88,7 +88,7 @@ YELP_HELP_INIT
 GTK_REQUIRED=3.14.0
 GLIB_REQUIRED=2.38.0
 GNOME_DESKTOP_REQUIRED=2.91.2
-GDKPIXBUF_REQUIRED=2.4.0
+GDKPIXBUF_REQUIRED=2.30.0
 GTK_PRINT_REQUIRED=3.5.4
 SHARED_MIME_INFO_REQUIRED=0.20
 EXEMPI_REQUIRED=1.99.5
diff --git a/src/eog-image-private.h b/src/eog-image-private.h
index 8948daf..e0c1592 100644
--- a/src/eog-image-private.h
+++ b/src/eog-image-private.h
@@ -55,7 +55,6 @@ struct _EogImagePrivate {
 
        goffset           bytes;
        gchar            *file_type;
-       gboolean          threadsafe_format;
 
        /* Holds EXIF raw data */
        guint             exif_chunk_len;
diff --git a/src/eog-image.c b/src/eog-image.c
index b11c8cb..089ec73 100644
--- a/src/eog-image.c
+++ b/src/eog-image.c
@@ -498,40 +498,6 @@ eog_image_emit_size_prepared (EogImage *img)
                         g_object_ref (img), g_object_unref);
 }
 
-static gboolean
-check_loader_threadsafety (GdkPixbufLoader *loader, gboolean *result)
-{
-       GdkPixbufFormat *format;
-       gboolean ret_val = FALSE;
-
-       format = gdk_pixbuf_loader_get_format (loader);
-       if (format) {
-               ret_val = TRUE;
-               if (result)
-               /* FIXME: We should not be accessing this struct internals
-                * directly. Keep track of bug #469209 to fix that. */
-                       *result = format->flags & GDK_PIXBUF_FORMAT_THREADSAFE;
-       }
-
-       return ret_val;
-}
-
-static void
-eog_image_pre_size_prepared (GdkPixbufLoader *loader,
-                            gint width,
-                            gint height,
-                            gpointer data)
-{
-       EogImage *img;
-
-       eog_debug (DEBUG_IMAGE_LOAD);
-
-       g_return_if_fail (EOG_IS_IMAGE (data));
-
-       img = EOG_IMAGE (data);
-       check_loader_threadsafety (loader, &img->priv->threadsafe_format);
-}
-
 static void
 eog_image_size_prepared (GdkPixbufLoader *loader,
                         gint             width,
@@ -554,9 +520,7 @@ eog_image_size_prepared (GdkPixbufLoader *loader,
        g_mutex_unlock (&img->priv->status_mutex);
 
 #ifdef HAVE_EXIF
-       if (img->priv->threadsafe_format && (!img->priv->autorotate || img->priv->exif))
-#else
-       if (img->priv->threadsafe_format)
+       if (!img->priv->autorotate || img->priv->exif)
 #endif
                eog_image_emit_size_prepared (img);
 }
@@ -972,8 +936,6 @@ eog_image_real_load (EogImage *img,
                priv->file_type = NULL;
        }
 
-       priv->threadsafe_format = FALSE;
-
        eog_image_get_file_info (img, &priv->bytes, &mime_type, error);
 
        if (error && *error) {
@@ -1016,8 +978,6 @@ eog_image_real_load (EogImage *img,
        buffer = g_new0 (guchar, EOG_IMAGE_READ_BUFFER_SIZE);
 
        if (read_image_data || read_only_dimension) {
-               gboolean checked_threadsafety = FALSE;
-
 #ifdef HAVE_RSVG
                if (priv->svg != NULL) {
                        g_object_unref (priv->svg);
@@ -1047,21 +1007,8 @@ eog_image_real_load (EogImage *img,
                                *error = NULL;
 
                                loader = gdk_pixbuf_loader_new ();
-                       } else {
-                               /* The mimetype-based loader should know the
-                                * format here already. */
-                               checked_threadsafety = check_loader_threadsafety (loader, 
&priv->threadsafe_format);
                        }
 
-               /* This is used to detect non-threadsafe loaders and disable
-                * any possible asyncronous task that could bring deadlocks
-                * to image loading process. */
-                       if (!checked_threadsafety)
-                               g_signal_connect (loader,
-                                         "size-prepared",
-                                         G_CALLBACK (eog_image_pre_size_prepared),
-                                         img);
-
                        g_signal_connect_object (G_OBJECT (loader),
                                         "size-prepared",
                                         G_CALLBACK (eog_image_size_prepared),
@@ -1134,16 +1081,15 @@ eog_image_real_load (EogImage *img,
                                if (data2read == EOG_IMAGE_DATA_EXIF) {
                                        g_set_error (error,
                                                     EOG_IMAGE_ERROR,
-                                                    EOG_IMAGE_ERROR_GENERIC,
-                                                    _("EXIF not supported for this file format."));
+                                                    EOG_IMAGE_ERROR_GENERIC,
+                                                    _("EXIF not supported for this file format."));
                                        break;
                                }
 
-                               if (priv->threadsafe_format)
-                                       eog_image_emit_size_prepared (img);
+                               eog_image_emit_size_prepared (img);
 
-                                priv->metadata_status = EOG_IMAGE_METADATA_NOT_AVAILABLE;
-                        }
+                               priv->metadata_status = EOG_IMAGE_METADATA_NOT_AVAILABLE;
+                       }
 
                        first_run = FALSE;
                }
@@ -1257,11 +1203,6 @@ eog_image_real_load (EogImage *img,
                        /* Set orientation again for safety, eg. if we don't
                         * have Exif data or HAVE_EXIF is undefined. */
                        eog_image_set_orientation (img);
-
-                       /* If it's non-threadsafe loader, then trigger window
-                        * showing in the end of the process. */
-                       if (!priv->threadsafe_format)
-                               eog_image_emit_size_prepared (img);
                } else {
                        /* Some loaders don't report errors correctly.
                         * Error will be set below. */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]