[Xfce4-commits] <ristretto:master> Fix reference-count bug

Stephan Arts noreply at xfce.org
Tue Jul 13 22:50:01 CEST 2010


Updating branch refs/heads/master
         to c75e15a27427188fbd1e0a8bbaa308ad3fd74372 (commit)
       from 7a16abe0ade061dbd5e5c864e8fb45bbfdb65b3b (commit)

commit c75e15a27427188fbd1e0a8bbaa308ad3fd74372
Author: Stephan Arts <stephan at xfce.org>
Date:   Tue Jul 13 22:49:31 2010 +0200

    Fix reference-count bug

 ChangeLog        |    5 +++++
 src/image_list.c |   31 +++----------------------------
 2 files changed, 8 insertions(+), 28 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 5a979e9..8e3f70e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,9 @@
 2010-07-13 Stephan Arts <stephan at xfce.org>
+
+	* src/image_list.c: Fix reference-count bug.
+
+2010-07-13 Stephan Arts <stephan at xfce.org>
+
 	* src/Makefile.am: Add -lX11 to LDADD, fixes --no-add-needed build
 
 2010-07-12 Stephan Arts <stephan at xfce.org>
diff --git a/src/image_list.c b/src/image_list.c
index 1a53d68..9346d98 100644
--- a/src/image_list.c
+++ b/src/image_list.c
@@ -293,7 +293,7 @@ rstto_image_list_remove_all (RsttoImageList *image_list)
     iter = image_list->priv->iterators;
     while (iter)
     {
-        rstto_image_list_iter_set_position (iter->data, 0);
+        rstto_image_list_iter_set_position (iter->data, -1);
         iter = g_slist_next (iter);
     }
     g_signal_emit (G_OBJECT (image_list), rstto_image_list_signals[RSTTO_IMAGE_LIST_SIGNAL_REMOVE_ALL], 0, NULL);
@@ -372,7 +372,6 @@ rstto_image_list_iter_dispose (GObject *object)
     RsttoImageListIter *iter = RSTTO_IMAGE_LIST_ITER(object);
     if (iter->priv->image)
     {
-        g_object_unref (iter->priv->image);
         iter->priv->image = NULL;
     }
 
@@ -390,10 +389,6 @@ rstto_image_list_iter_new (RsttoImageList *nav, RsttoImage *image)
 
     iter = g_object_new(RSTTO_TYPE_IMAGE_LIST_ITER, NULL);
     iter->priv->image = image;
-    if (image)
-    {
-        g_object_ref (image);
-    }
     iter->priv->image_list = nav;
 
     return iter;
@@ -409,13 +404,8 @@ rstto_image_list_iter_find_image (RsttoImageListIter *iter, RsttoImage *image)
 
         if (iter->priv->image)
         {
-            g_object_unref (iter->priv->image);
             iter->priv->image = NULL;
         }
-        if (image)
-        {
-            g_object_ref (image);
-        }
         iter->priv->image = image;
 
         g_signal_emit (G_OBJECT (iter), rstto_image_list_iter_signals[RSTTO_IMAGE_LIST_ITER_SIGNAL_CHANGED], 0, NULL);
@@ -449,14 +439,12 @@ rstto_image_list_iter_set_position (RsttoImageListIter *iter, gint pos)
 
     if (iter->priv->image)
     {
-        g_object_unref (iter->priv->image);
         iter->priv->image = NULL;
     }
 
-    iter->priv->image = g_list_nth_data (iter->priv->image_list->priv->images, pos); 
-    if (iter->priv->image)
+    if (pos >= 0)
     {
-        g_object_ref (iter->priv->image);
+        iter->priv->image = g_list_nth_data (iter->priv->image_list->priv->images, pos); 
     }
 
     g_signal_emit (G_OBJECT (iter), rstto_image_list_iter_signals[RSTTO_IMAGE_LIST_ITER_SIGNAL_CHANGED], 0, NULL);
@@ -473,7 +461,6 @@ rstto_image_list_iter_next (RsttoImageListIter *iter)
     if (iter->priv->image)
     {
         position = g_list_find (iter->priv->image_list->priv->images, iter->priv->image);
-        g_object_unref (iter->priv->image);
         iter->priv->image = NULL;
     }
 
@@ -497,11 +484,6 @@ rstto_image_list_iter_next (RsttoImageListIter *iter)
         g_object_unref (settings);
     }
 
-    if (iter->priv->image)
-    {
-        g_object_ref (iter->priv->image);
-    }
-
     g_signal_emit (G_OBJECT (iter), rstto_image_list_iter_signals[RSTTO_IMAGE_LIST_ITER_SIGNAL_CHANGED], 0, NULL);
 }
 
@@ -517,7 +499,6 @@ rstto_image_list_iter_previous (RsttoImageListIter *iter)
     {
         position = g_list_find (iter->priv->image_list->priv->images, iter->priv->image);
         iter->priv->image = NULL;
-        g_object_unref (iter->priv->image);
     }
 
     position = g_list_previous (position);
@@ -540,12 +521,6 @@ rstto_image_list_iter_previous (RsttoImageListIter *iter)
         g_object_unref (settings);
     }
 
-    if (iter->priv->image)
-    {
-        g_object_ref (iter->priv->image);
-    }
-
-
     g_signal_emit (G_OBJECT (iter), rstto_image_list_iter_signals[RSTTO_IMAGE_LIST_ITER_SIGNAL_CHANGED], 0, NULL);
 }
 



More information about the Xfce4-commits mailing list