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,12 +364,11 @@ gimp_draw_tool_widget_status (GimpToolWidget *widget,
{ {
GimpDrawTool *draw_tool = GIMP_DRAW_TOOL (tool); GimpDrawTool *draw_tool = GIMP_DRAW_TOOL (tool);
if (gimp_draw_tool_is_active (draw_tool))
{
if (status) if (status)
{
gimp_tool_replace_status (tool, draw_tool->display, "%s", status); gimp_tool_replace_status (tool, draw_tool->display, "%s", status);
}
else else
{
gimp_tool_pop_status (tool, draw_tool->display); 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); GimpDrawTool *draw_tool = GIMP_DRAW_TOOL (tool);
if (gimp_draw_tool_is_active (draw_tool))
{
gimp_tool_pop_status (tool, draw_tool->display); gimp_tool_pop_status (tool, draw_tool->display);
gimp_tool_push_status_coords (tool, draw_tool->display, gimp_tool_push_status_coords (tool, draw_tool->display,
gimp_tool_control_get_precision (tool->control), gimp_tool_control_get_precision (
tool->control),
title, x, separator, y, help); title, x, separator, y, help);
}
} }
static void static void
@ -398,6 +401,7 @@ gimp_draw_tool_widget_message (GimpToolWidget *widget,
{ {
GimpDrawTool *draw_tool = GIMP_DRAW_TOOL (tool); GimpDrawTool *draw_tool = GIMP_DRAW_TOOL (tool);
if (gimp_draw_tool_is_active (draw_tool))
gimp_tool_message_literal (tool, draw_tool->display, message); gimp_tool_message_literal (tool, draw_tool->display, message);
} }