[eog] Don't access Exif data unconditionally, even in EogImage itself



commit 66d71ddf5d7129a02bcee28931ba6e8d8d592289
Author: Felix Riemann <friemann gnome org>
Date:   Mon Aug 24 18:08:42 2009 +0200

    Don't access Exif data unconditionally, even in EogImage itself
    
    This could lead to a race condition with broken Exif data when having
    certain plugins like the statusbar-date plugin enabled.
    This hopefully fixes bgo#590693.

 src/eog-image.c |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/src/eog-image.c b/src/eog-image.c
index 19e1b19..04caec2 100644
--- a/src/eog-image.c
+++ b/src/eog-image.c
@@ -678,15 +678,18 @@ static void
 eog_image_set_orientation (EogImage *img)
 {
 	EogImagePrivate *priv;
+	ExifData* exif;
 
 	g_return_if_fail (EOG_IS_IMAGE (img));
 
 	priv = img->priv;
 
-	if (priv->exif != NULL) {
-		ExifByteOrder o = exif_data_get_byte_order (priv->exif);
+	exif = (ExifData*) eog_image_get_exif_info (img);
 
-		ExifEntry *entry = exif_data_get_entry (priv->exif,
+	if (exif != NULL) {
+		ExifByteOrder o = exif_data_get_byte_order (exif);
+
+		ExifEntry *entry = exif_data_get_entry (exif,
 							EXIF_TAG_ORIENTATION);
 
 		if (entry && entry->data != NULL) {
@@ -694,6 +697,9 @@ eog_image_set_orientation (EogImage *img)
 		}
 	}
 
+	/* exif_data_unref handles NULL values like g_free */
+	exif_data_unref (exif);
+
 	if (priv->orientation > 4 &&
 	    priv->orientation < 9) {
 		gint tmp;



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