[gimp] app: fix curves and levels tool to not crash with how GimpFilterTool works now



commit bc708fb2fba6779824a61a60b16e6747d5afa55d
Author: Michael Natterer <mitch gimp org>
Date:   Wed Jul 5 12:24:47 2017 +0200

    app: fix curves and levels tool to not crash with how GimpFilterTool works now
    
    The tool dialog can now be completely shut down and re-created, make
    sure we don't run into dangling pointers in the time when there is no
    dialog.

 app/tools/gimpcurvestool.c |    5 ++++-
 app/tools/gimplevelstool.c |    5 ++++-
 2 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/app/tools/gimpcurvestool.c b/app/tools/gimpcurvestool.c
index 54ee687..2ef4800 100644
--- a/app/tools/gimpcurvestool.c
+++ b/app/tools/gimpcurvestool.c
@@ -406,6 +406,9 @@ gimp_curves_tool_dialog (GimpFilterTool *filter_tool)
     gimp_enum_combo_box_new_with_model (GIMP_ENUM_STORE (store));
   g_object_unref (store);
 
+  g_object_add_weak_pointer (G_OBJECT (tool->channel_menu),
+                             (gpointer) &tool->channel_menu);
+
   gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (tool->channel_menu),
                                  config->channel);
   gimp_enum_combo_box_set_icon_prefix (GIMP_ENUM_COMBO_BOX (tool->channel_menu),
@@ -584,7 +587,7 @@ gimp_curves_tool_config_notify (GimpFilterTool   *filter_tool,
   GIMP_FILTER_TOOL_CLASS (parent_class)->config_notify (filter_tool,
                                                         config, pspec);
 
-  if (! curves_tool->xrange)
+  if (! curves_tool->channel_menu)
     return;
 
   if (! strcmp (pspec->name, "channel"))
diff --git a/app/tools/gimplevelstool.c b/app/tools/gimplevelstool.c
index 504669f..60be850 100644
--- a/app/tools/gimplevelstool.c
+++ b/app/tools/gimplevelstool.c
@@ -352,6 +352,9 @@ gimp_levels_tool_dialog (GimpFilterTool *filter_tool)
     gimp_enum_combo_box_new_with_model (GIMP_ENUM_STORE (store));
   g_object_unref (store);
 
+  g_object_add_weak_pointer (G_OBJECT (tool->channel_menu),
+                             (gpointer) &tool->channel_menu);
+
   gimp_enum_combo_box_set_icon_prefix (GIMP_ENUM_COMBO_BOX (tool->channel_menu),
                                        "gimp-channel");
   gimp_int_combo_box_set_sensitivity (GIMP_INT_COMBO_BOX (tool->channel_menu),
@@ -639,7 +642,7 @@ gimp_levels_tool_config_notify (GimpFilterTool   *filter_tool,
   GIMP_FILTER_TOOL_CLASS (parent_class)->config_notify (filter_tool,
                                                         config, pspec);
 
-  if (! levels_tool->low_input)
+  if (! levels_tool->channel_menu)
     return;
 
   if (! strcmp (pspec->name, "channel"))


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