app: check that GimpTool's display is present before actual commit.

A tool commit can be triggered in various cases, and the tool manager
relies on gimp_tool_has_display() to decide whether to run a tool
action. This function does much more than just checking GimpTool's
display. It also checks status_displays, and for a transform tool in
particular, it checks GimpDrawTool's display. This may be right for
other tools (I have no idea), so I can't just change this function.
Anyway we have to assume it is not a programming error if a transform
tool gets a COMMIT action while display is NULL (i.e. tool is halted).
When this happens, let's simply ignore.

This fixes the edge case raised by Ell, in comment 2 of bug 793150: when
an image has no layer, transform tools can't work and display is NULL.
But it still outputs status messages and therefore status_displays is
not empty. So the tool manager will still run a COMMIT action, which is
not an error. We only have to discard such COMMIT silently.
This commit is contained in:
Jehan
2018-02-11 02:08:42 +01:00
parent fa53be1a57
commit 7aa7e3ca23

View File

@ -317,7 +317,8 @@ gimp_transform_tool_control (GimpTool *tool,
break; break;
case GIMP_TOOL_ACTION_COMMIT: case GIMP_TOOL_ACTION_COMMIT:
gimp_transform_tool_commit (tr_tool); if (tool->display)
gimp_transform_tool_commit (tr_tool);
break; break;
} }