[gimp] app: in GimpDrawTool, avoid CRITICAL on widget signal if not active



commit 34e6c8734b791ad403cbf17d6d139cc41e6fd253
Author: Ell <ell_se yahoo com>
Date:   Sun Jan 13 07:53:12 2019 -0500

    app: in GimpDrawTool, avoid CRITICAL on widget signal if not active
    
    In GimpDrawTool, do nothing in the tool-widget signal handlers if
    the draw-tool isn't active, to avoid CRITICALs due to a NULL
    display.  This can happen if a widget is set before the tool is
    started.

 app/tools/gimpdrawtool.c | 26 +++++++++++++++-----------
 1 file changed, 15 insertions(+), 11 deletions(-)
---
diff --git a/app/tools/gimpdrawtool.c b/app/tools/gimpdrawtool.c
index c26de07272..2625f35537 100644
--- a/app/tools/gimpdrawtool.c
+++ b/app/tools/gimpdrawtool.c
@@ -364,13 +364,12 @@ gimp_draw_tool_widget_status (GimpToolWidget *widget,
 {
   GimpDrawTool *draw_tool = GIMP_DRAW_TOOL (tool);
 
-  if (status)
+  if (gimp_draw_tool_is_active (draw_tool))
     {
-      gimp_tool_replace_status (tool, draw_tool->display, "%s", status);
-    }
-  else
-    {
-      gimp_tool_pop_status (tool, draw_tool->display);
+      if (status)
+        gimp_tool_replace_status (tool, draw_tool->display, "%s", status);
+      else
+        gimp_tool_pop_status (tool, draw_tool->display);
     }
 }
 
@@ -385,10 +384,14 @@ gimp_draw_tool_widget_status_coords (GimpToolWidget *widget,
 {
   GimpDrawTool *draw_tool = GIMP_DRAW_TOOL (tool);
 
-  gimp_tool_pop_status (tool, draw_tool->display);
-  gimp_tool_push_status_coords (tool, draw_tool->display,
-                                gimp_tool_control_get_precision (tool->control),
-                                title, x, separator, y, help);
+  if (gimp_draw_tool_is_active (draw_tool))
+    {
+      gimp_tool_pop_status (tool, draw_tool->display);
+      gimp_tool_push_status_coords (tool, draw_tool->display,
+                                    gimp_tool_control_get_precision (
+                                      tool->control),
+                                    title, x, separator, y, help);
+    }
 }
 
 static void
@@ -398,7 +401,8 @@ gimp_draw_tool_widget_message (GimpToolWidget *widget,
 {
   GimpDrawTool *draw_tool = GIMP_DRAW_TOOL (tool);
 
-  gimp_tool_message_literal (tool, draw_tool->display, message);
+  if (gimp_draw_tool_is_active (draw_tool))
+    gimp_tool_message_literal (tool, draw_tool->display, message);
 }
 
 static void


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