[gimp/gimp-2-10] app: various fixes to last commits



commit b0f0013af695391aeaebecdf0743eeb58512398c
Author: Ell <ell_se yahoo com>
Date:   Thu Jan 30 10:45:41 2020 +0200

    app: various fixes to last commits
    
    (cherry picked from commit bae9f2d8803b8da57546953af38754823c843b86)

 app/tools/gimp-tools.c       | 22 ++++++++++++++++++----
 app/widgets/gimptoolbutton.c |  3 +--
 2 files changed, 19 insertions(+), 6 deletions(-)
---
diff --git a/app/tools/gimp-tools.c b/app/tools/gimp-tools.c
index 891ac6a5c0..1ad466f36d 100644
--- a/app/tools/gimp-tools.c
+++ b/app/tools/gimp-tools.c
@@ -503,7 +503,9 @@ gimp_tools_deserialize (Gimp          *gimp,
 
   gimp_container_freeze (container);
 
+  /* make sure the various GimpToolItem types are registered */
   g_type_class_unref (g_type_class_ref (GIMP_TYPE_TOOL_GROUP));
+  g_type_class_unref (g_type_class_ref (GIMP_TYPE_TOOL_INFO));
 
   gimp_container_clear (container);
 
@@ -767,10 +769,20 @@ gimp_tools_copy_structure (Gimp          *gimp,
           dest_tool_item = GIMP_TOOL_ITEM (
             gimp_get_tool_info (gimp, gimp_object_get_name (src_tool_item)));
 
-          if (dest_tool_item && GIMP_TOOL_INFO (dest_tool_item)->hidden)
-            dest_tool_item = NULL;
-          else if (tools)
-            g_hash_table_add (tools, dest_tool_item);
+          if (dest_tool_item)
+            {
+              if (! GIMP_TOOL_INFO (dest_tool_item)->hidden)
+                {
+                  g_object_ref (dest_tool_item);
+
+                  if (tools)
+                    g_hash_table_add (tools, dest_tool_item);
+                }
+              else
+                {
+                  dest_tool_item = NULL;
+                }
+            }
         }
 
       if (dest_tool_item)
@@ -781,6 +793,8 @@ gimp_tools_copy_structure (Gimp          *gimp,
 
           gimp_container_add (dest_container,
                               GIMP_OBJECT (dest_tool_item));
+
+          g_object_unref (dest_tool_item);
         }
     }
 }
diff --git a/app/widgets/gimptoolbutton.c b/app/widgets/gimptoolbutton.c
index 90d1977af0..81c4f29e65 100644
--- a/app/widgets/gimptoolbutton.c
+++ b/app/widgets/gimptoolbutton.c
@@ -190,8 +190,7 @@ gimp_tool_button_class_init (GimpToolButtonClass *klass)
                                    g_param_spec_object ("tool-item",
                                                         NULL, NULL,
                                                         GIMP_TYPE_TOOL_ITEM,
-                                                        GIMP_PARAM_READWRITE |
-                                                        G_PARAM_CONSTRUCT));
+                                                        GIMP_PARAM_READWRITE));
 }
 
 static void


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