app: do not add undo step when clearing an already empty channel.

See also bug 787545 about single-clicking with a selection tool creating
an undo step even when there were already no selections.
This commit is contained in:
Jehan 2017-09-13 12:59:29 +02:00
parent 0d9a85a207
commit 9c94072213
1 changed files with 7 additions and 3 deletions

View File

@ -1316,10 +1316,14 @@ gimp_channel_real_clear (GimpChannel *channel,
{
if (push_undo)
{
if (! undo_desc)
undo_desc = GIMP_CHANNEL_GET_CLASS (channel)->clear_desc;
if (! channel->empty)
{
/* Don't push an undo if the channel was already empty. */
if (! undo_desc)
undo_desc = GIMP_CHANNEL_GET_CLASS (channel)->clear_desc;
gimp_channel_push_undo (channel, undo_desc);
gimp_channel_push_undo (channel, undo_desc);
}
}
else
{