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.
This commit is contained in:
Ell 2019-01-13 07:53:12 -05:00
parent a9883e98e3
commit 34e6c8734b
1 changed files with 15 additions and 11 deletions

View File

@ -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