Fix crash double-clicking a moving selection (fix regression in 7b07f29f0b)

Here we avoid two ExpandCelCanvas at the same time with
MovingPixelsState + DrawingState. Double-clicking inside the selection
when we are moving it (MovingPixelsState) could start a new
DrawingState which creates a new ToolLoopImpl that needs a new
ExpandCelCanvas. So we have to drop the pixels before.
This commit is contained in:
David Capello 2020-02-17 08:28:30 -03:00
parent 7b07f29f0b
commit 9fe05a5dd5

View File

@ -395,6 +395,10 @@ bool StandbyState::onDoubleClick(Editor* editor, MouseMessage* msg)
// Select a tile with double-click
if (ink->isSelection() &&
Preferences::instance().selection.doubleclickSelectTile()) {
// Drop pixels if we are in moving pixels state
if (MovingPixelsState* movingPixels = dynamic_cast<MovingPixelsState*>(editor->getState().get()))
editor->backToPreviousState();
// Start a tool-loop selecting tiles.
startDrawingState(editor,
DrawingType::SelectTiles,