[gimp/gimp-2-10] app: fix CRITICALs in GimpMeasureTool



commit 6495b6d02338e6b1ff38af27178619d34c2b7db4
Author: Ell <ell_se yahoo com>
Date:   Mon Feb 4 09:36:35 2019 -0500

    app: fix CRITICALs in GimpMeasureTool
    
    In GimpMeasureTool, don't try to access the "straighten" button
    when halting the tool if it's NULL, which can happen when the
    measure tool is selected upon startup, but is changed before its
    tool-options GUI is constructed.
    
    (cherry picked from commit 7fc5698f32a144336d6732eabb1a0cdc7be8f757)

 app/tools/gimpmeasuretool.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)
---
diff --git a/app/tools/gimpmeasuretool.c b/app/tools/gimpmeasuretool.c
index e7d003e4b3..2d72384fe7 100644
--- a/app/tools/gimpmeasuretool.c
+++ b/app/tools/gimpmeasuretool.c
@@ -494,7 +494,15 @@ gimp_measure_tool_halt (GimpMeasureTool *measure)
   GimpMeasureOptions *options = GIMP_MEASURE_TOOL_GET_OPTIONS (measure);
   GimpTool           *tool    = GIMP_TOOL (measure);
 
-  gtk_widget_set_sensitive (options->straighten_button, FALSE);
+  if (options->straighten_button)
+    {
+      gtk_widget_set_sensitive (options->straighten_button, FALSE);
+
+      g_signal_handlers_disconnect_by_func (
+        options->straighten_button,
+        G_CALLBACK (gimp_measure_tool_straighten_button_clicked),
+        measure);
+    }
 
   if (tool->display)
     gimp_tool_pop_status (tool, tool->display);
@@ -502,11 +510,6 @@ gimp_measure_tool_halt (GimpMeasureTool *measure)
   if (gimp_draw_tool_is_active (GIMP_DRAW_TOOL (measure)))
     gimp_draw_tool_stop (GIMP_DRAW_TOOL (measure));
 
-  g_signal_handlers_disconnect_by_func (
-    options->straighten_button,
-    G_CALLBACK (gimp_measure_tool_straighten_button_clicked),
-    measure);
-
   gimp_draw_tool_set_widget (GIMP_DRAW_TOOL (tool), NULL);
   g_clear_object (&measure->widget);
 


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