Commit 3a462a5e authored by Ell's avatar Ell

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.
parent 9d3b2ba7
Pipeline #200104 passed with stages
in 30 minutes and 30 seconds
......@@ -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:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment