[gimp] app: Fix GimpTag reference handling



commit 73b86bd9c9295a2ba150a27d3793407fc23d89c0
Author: Aurimas Juška <aurimas juska gmail com>
Date:   Wed Mar 3 23:25:17 2010 +0200

    app: Fix GimpTag reference handling

 app/core/gimpdata.c   |    1 +
 app/core/gimptagged.c |   17 +++++++++++++++--
 2 files changed, 16 insertions(+), 2 deletions(-)
---
diff --git a/app/core/gimpdata.c b/app/core/gimpdata.c
index dadec52..b48088b 100644
--- a/app/core/gimpdata.c
+++ b/app/core/gimpdata.c
@@ -274,6 +274,7 @@ gimp_data_finalize (GObject *object)
 
   if (private->tags)
     {
+      g_list_foreach (private->tags, (GFunc) g_object_unref, NULL);
       g_list_free (private->tags);
       private->tags = NULL;
     }
diff --git a/app/core/gimptagged.c b/app/core/gimptagged.c
index 4cc1a71..375f748 100644
--- a/app/core/gimptagged.c
+++ b/app/core/gimptagged.c
@@ -130,11 +130,24 @@ void
 gimp_tagged_remove_tag (GimpTagged *tagged,
                         GimpTag    *tag)
 {
+  GList        *tag_iter;
+
   g_return_if_fail (GIMP_IS_TAGGED (tagged));
 
-  if (GIMP_TAGGED_GET_INTERFACE (tagged)->remove_tag (tagged, tag))
+  for (tag_iter = gimp_tagged_get_tags (tagged); tag_iter;
+       tag_iter = g_list_next (tag_iter))
     {
-      g_signal_emit (tagged, gimp_tagged_signals[TAG_REMOVED], 0, tag);
+      GimpTag *tag_ref = GIMP_TAG (tag_iter->data);
+
+      if (gimp_tag_equals (tag_ref, tag))
+        {
+          g_object_ref (tag_ref);
+          if (GIMP_TAGGED_GET_INTERFACE (tagged)->remove_tag (tagged, tag_ref))
+            {
+              g_signal_emit (tagged, gimp_tagged_signals[TAG_REMOVED], 0, tag_ref);
+            }
+          g_object_unref (tag_ref);
+        }
     }
 }
 



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