Skip to content

Commit

Permalink
Fix ScrollingState crash (fix #2115)
Browse files Browse the repository at this point in the history
Before this fix Aseprite was crashing when we kept holding the mouse
middle button down, then pasting, and finally pressing undo.
  • Loading branch information
Gasparoken authored and dacap committed Jul 31, 2019
1 parent c409494 commit 2d3be68
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/app/ui/editor/scrolling_state.h
Expand Up @@ -25,6 +25,14 @@ namespace app {
virtual bool onKeyUp(Editor* editor, ui::KeyMessage* msg) override;
virtual bool onUpdateStatusBar(Editor* editor) override;

virtual LeaveAction onLeaveState(Editor* editor, EditorState* newState) override {
// Just discard this state if we want to enter to another state
// e.g. if we want to enter to MovingPixelsState when the user
// press Ctrl+V when we are scrolling, we have to just discard
// this state (stop the scrolling action).
return DiscardState;
}

private:
gfx::Point m_oldPos;
};
Expand Down

0 comments on commit 2d3be68

Please sign in to comment.