[frogr] Fix severe bug in frogr_picture_set_location()



commit 9870b1a5f5b169e65bd5e55858f2d8e741ce86f3
Author: Mario Sanchez Prada <msanchez igalia com>
Date:   Mon Aug 15 15:33:02 2011 +0200

    Fix severe bug in frogr_picture_set_location()
    
    And get back to its place the g_object_unref() in the
    FrogrPictureLoader, temporarily moved yesterday.

 src/frogr-picture-loader.c |   16 ++++++----------
 src/frogr-picture.c        |    9 +++++++--
 2 files changed, 13 insertions(+), 12 deletions(-)
---
diff --git a/src/frogr-picture-loader.c b/src/frogr-picture-loader.c
index 37061c6..8f6a49a 100644
--- a/src/frogr-picture-loader.c
+++ b/src/frogr-picture-loader.c
@@ -372,8 +372,6 @@ _load_next_picture_cb (GObject *object,
           exif_data = exif_loader_get_data (exif_loader);
           if (exif_data)
             {
-              FspDataLocation *location;
-
               exif_entry = exif_data_get_entry (exif_data, EXIF_TAG_DATE_TIME);
               if (exif_entry)
                 {
@@ -388,11 +386,11 @@ _load_next_picture_cb (GObject *object,
                   else
                     g_warning ("Found DateTime exif tag of invalid type");
                 }
-              location = get_location_from_exif (exif_data);
-              if (location != NULL)
+              priv->location = get_location_from_exif (exif_data);
+              if (priv->location != NULL)
                 {
                   /* frogr_picture_set_location takes ownership of location */
-                  frogr_picture_set_location (fpicture, location);
+                  frogr_picture_set_location (fpicture, priv->location);
                 }
               exif_data_unref (exif_data);
             }
@@ -441,14 +439,12 @@ _load_next_picture_cb (GObject *object,
   if (priv->picture_loaded_cb && fpicture)
     keep_going = priv->picture_loaded_cb (priv->object, fpicture);
 
+  if (fpicture != NULL)
+    g_object_unref (fpicture);
+
   /* Go for the next picture, if needed */
   if (keep_going)
-    {
-      if (fpicture != NULL)
-        g_object_unref (fpicture);
-
     _load_next_picture (self);
-    }
   else
     {
       /* Execute final callback */
diff --git a/src/frogr-picture.c b/src/frogr-picture.c
index 3b69cc5..677b973 100644
--- a/src/frogr-picture.c
+++ b/src/frogr-picture.c
@@ -907,8 +907,13 @@ frogr_picture_set_location (FrogrPicture *self, FspDataLocation *location)
   g_return_if_fail(FROGR_IS_PICTURE(self));
 
   priv = FROGR_PICTURE_GET_PRIVATE (self);
-  fsp_data_free (FSP_DATA (location));
-  priv->location = location;
+  if (priv->location)
+    fsp_data_free (FSP_DATA (priv->location));
+
+  if (location)
+    priv->location = FSP_DATA_LOCATION (fsp_data_copy (FSP_DATA (location)));
+  else
+    priv->location = NULL;
 }
 
 gboolean



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