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



commit 7aa7e3ca236fca7e51dc79dadbc3b407a91bec05
Author: Jehan <jehan girinstud io>
Date:   Sun Feb 11 02:08:42 2018 +0100

    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.

 app/tools/gimptransformtool.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/app/tools/gimptransformtool.c b/app/tools/gimptransformtool.c
index 2b1575d..08ce1bc 100644
--- a/app/tools/gimptransformtool.c
+++ b/app/tools/gimptransformtool.c
@@ -317,7 +317,8 @@ gimp_transform_tool_control (GimpTool       *tool,
      break;
 
     case GIMP_TOOL_ACTION_COMMIT:
-      gimp_transform_tool_commit (tr_tool);
+      if (tool->display)
+        gimp_transform_tool_commit (tr_tool);
       break;
     }
 


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