[gimp] Issue #5472 - CRITICAL while using Move tool with arrow keys
- From: Ell <ell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] Issue #5472 - CRITICAL while using Move tool with arrow keys
- Date: Wed, 29 Jul 2020 17:09:24 +0000 (UTC)
commit 3a462a5e63dafb240327efba6bd0d26515c2b9dc
Author: Ell <ell_se yahoo com>
Date: Wed Jul 29 20:04:19 2020 +0300
Issue #5472 - CRITICAL while using Move tool with arrow keys
In gimp_edit_selection_tool_translate(), perform the active-item
checks even when the effective translation offset is 0, and only
bail afterwards. This avoids erroneously calling
gimp_tool_message_literal() with a NULL message in this case.
app/tools/gimpeditselectiontool.c | 152 +++++++++++++++++++-------------------
1 file changed, 76 insertions(+), 76 deletions(-)
---
diff --git a/app/tools/gimpeditselectiontool.c b/app/tools/gimpeditselectiontool.c
index ce05c9cd2b..2db33f0007 100644
--- a/app/tools/gimpeditselectiontool.c
+++ b/app/tools/gimpeditselectiontool.c
@@ -1044,106 +1044,103 @@ gimp_edit_selection_tool_translate (GimpTool *tool,
0);
- if (inc_x != 0 || inc_y != 0)
+ switch (translate_type)
{
- switch (translate_type)
+ case GIMP_TRANSFORM_TYPE_SELECTION:
+ item = GIMP_ITEM (gimp_image_get_mask (image));
+
+ if (gimp_channel_is_empty (GIMP_CHANNEL (item)))
+ item = NULL;
+
+ edit_mode = GIMP_TRANSLATE_MODE_MASK;
+ undo_type = GIMP_UNDO_GROUP_MASK;
+
+ if (! item)
+ {
+ /* cannot happen, don't translate this message */
+ null_message = "There is no selection to move.";
+ }
+ else if (gimp_item_is_position_locked (item))
{
- case GIMP_TRANSFORM_TYPE_SELECTION:
- item = GIMP_ITEM (gimp_image_get_mask (image));
+ /* cannot happen, don't translate this message */
+ locked_message = "The selection's position is locked.";
+ }
+ break;
- if (gimp_channel_is_empty (GIMP_CHANNEL (item)))
- item = NULL;
+ case GIMP_TRANSFORM_TYPE_PATH:
+ item = GIMP_ITEM (gimp_image_get_active_vectors (image));
- edit_mode = GIMP_TRANSLATE_MODE_MASK;
- undo_type = GIMP_UNDO_GROUP_MASK;
+ edit_mode = GIMP_TRANSLATE_MODE_VECTORS;
+ undo_type = GIMP_UNDO_GROUP_ITEM_DISPLACE;
- if (! item)
- {
- /* cannot happen, don't translate this message */
- null_message = "There is no selection to move.";
- }
- else if (gimp_item_is_position_locked (item))
- {
- /* cannot happen, don't translate this message */
- locked_message = "The selection's position is locked.";
- }
- break;
+ if (! item)
+ {
+ null_message = _("There is no path to move.");
+ }
+ else if (gimp_item_is_position_locked (item))
+ {
+ locked_message = _("The active path's position is locked.");
+ }
+ break;
+
+ case GIMP_TRANSFORM_TYPE_LAYER:
+ item = GIMP_ITEM (gimp_image_get_active_drawable (image));
- case GIMP_TRANSFORM_TYPE_PATH:
- item = GIMP_ITEM (gimp_image_get_active_vectors (image));
+ undo_type = GIMP_UNDO_GROUP_ITEM_DISPLACE;
- edit_mode = GIMP_TRANSLATE_MODE_VECTORS;
- undo_type = GIMP_UNDO_GROUP_ITEM_DISPLACE;
+ if (! item)
+ {
+ null_message = _("There is no layer to move.");
+ }
+ else if (GIMP_IS_LAYER_MASK (item))
+ {
+ edit_mode = GIMP_TRANSLATE_MODE_LAYER_MASK;
- if (! item)
+ if (gimp_item_is_position_locked (item))
{
- null_message = _("There is no path to move.");
+ locked_message = _("The active layer's position is locked.");
}
- else if (gimp_item_is_position_locked (item))
+ else if (gimp_item_is_content_locked (item))
{
- locked_message = _("The active path's position is locked.");
+ locked_message = _("The active layer's pixels are locked.");
}
- break;
-
- case GIMP_TRANSFORM_TYPE_LAYER:
- item = GIMP_ITEM (gimp_image_get_active_drawable (image));
-
- undo_type = GIMP_UNDO_GROUP_ITEM_DISPLACE;
+ }
+ else if (GIMP_IS_CHANNEL (item))
+ {
+ edit_mode = GIMP_TRANSLATE_MODE_CHANNEL;
- if (! item)
+ if (gimp_item_is_position_locked (item))
{
- null_message = _("There is no layer to move.");
+ locked_message = _("The active channel's position is locked.");
}
- else if (GIMP_IS_LAYER_MASK (item))
+ else if (gimp_item_is_content_locked (item))
{
- edit_mode = GIMP_TRANSLATE_MODE_LAYER_MASK;
-
- if (gimp_item_is_position_locked (item))
- {
- locked_message = _("The active layer's position is locked.");
- }
- else if (gimp_item_is_content_locked (item))
- {
- locked_message = _("The active layer's pixels are locked.");
- }
+ locked_message = _("The active channel's pixels are locked.");
}
- else if (GIMP_IS_CHANNEL (item))
+ }
+ else if (gimp_layer_is_floating_sel (GIMP_LAYER (item)))
+ {
+ edit_mode = GIMP_TRANSLATE_MODE_FLOATING_SEL;
+
+ if (gimp_item_is_position_locked (item))
{
- edit_mode = GIMP_TRANSLATE_MODE_CHANNEL;
-
- if (gimp_item_is_position_locked (item))
- {
- locked_message = _("The active channel's position is locked.");
- }
- else if (gimp_item_is_content_locked (item))
- {
- locked_message = _("The active channel's pixels are locked.");
- }
+ locked_message = _("The active layer's position is locked.");
}
- else if (gimp_layer_is_floating_sel (GIMP_LAYER (item)))
- {
- edit_mode = GIMP_TRANSLATE_MODE_FLOATING_SEL;
+ }
+ else
+ {
+ edit_mode = GIMP_TRANSLATE_MODE_LAYER;
- if (gimp_item_is_position_locked (item))
- {
- locked_message = _("The active layer's position is locked.");
- }
- }
- else
+ if (gimp_item_is_position_locked (item))
{
- edit_mode = GIMP_TRANSLATE_MODE_LAYER;
-
- if (gimp_item_is_position_locked (item))
- {
- locked_message = _("The active layer's position is locked.");
- }
+ locked_message = _("The active layer's position is locked.");
}
+ }
- break;
+ break;
- case GIMP_TRANSFORM_TYPE_IMAGE:
- g_return_val_if_reached (FALSE);
- }
+ case GIMP_TRANSFORM_TYPE_IMAGE:
+ g_return_val_if_reached (FALSE);
}
if (! item)
@@ -1160,6 +1157,9 @@ gimp_edit_selection_tool_translate (GimpTool *tool,
return TRUE;
}
+ if (inc_x == 0 && inc_y == 0)
+ return TRUE;
+
switch (edit_mode)
{
case GIMP_TRANSLATE_MODE_FLOATING_SEL:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]