[gimp/gimp-2-8] app: let the tag popup own its tag objects



commit 37757e4e8dff76715a99394380c8809c5c3f0970
Author: Nils Philippsen <nils redhat com>
Date:   Tue Apr 16 11:16:41 2013 +0200

    app: let the tag popup own its tag objects
    
    This should fix crashes in which tag objects got accessed after they
    were disposed, because they still were stored with the popup object.
    (cherry picked from commit b109e0580650b4b49b6f00b15fec4bcd330fb045)

 app/widgets/gimptagpopup.c | 9 +++++++++
 1 file changed, 9 insertions(+)
---
diff --git a/app/widgets/gimptagpopup.c b/app/widgets/gimptagpopup.c
index f822ab2..fd913c2 100644
--- a/app/widgets/gimptagpopup.c
+++ b/app/widgets/gimptagpopup.c
@@ -257,6 +257,8 @@ gimp_tag_popup_constructed (GObject *object)
       tag_data->tag   = tag_iterator->data;
       tag_data->state = GTK_STATE_NORMAL;
 
+      g_object_ref (tag_data->tag);
+
       for (j = 0; j < current_count; j++)
         {
           if (! gimp_tag_compare_with_string (tag_data->tag, current_tags[j]))
@@ -386,6 +388,13 @@ gimp_tag_popup_dispose (GObject *object)
 
   if (popup->tag_data)
     {
+      gint i;
+
+      for (i = 0; i < popup->tag_count; i++)
+        {
+          g_object_unref (popup->tag_data[i].tag);
+        }
+
       g_free (popup->tag_data);
       popup->tag_data = NULL;
     }


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