From becdd90789ba4a2358d96592e79b424ea7c13318 Mon Sep 17 00:00:00 2001 From: David Capello Date: Thu, 28 Apr 2016 15:00:15 -0300 Subject: [PATCH] Block the document in MovingCelState so other commands cannot modify it (fix #1078) --- src/app/ui/editor/moving_cel_state.cpp | 7 ++++--- src/app/ui/editor/moving_cel_state.h | 2 ++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/app/ui/editor/moving_cel_state.cpp b/src/app/ui/editor/moving_cel_state.cpp index 4851565de..645c10c18 100644 --- a/src/app/ui/editor/moving_cel_state.cpp +++ b/src/app/ui/editor/moving_cel_state.cpp @@ -34,9 +34,10 @@ namespace app { using namespace ui; MovingCelState::MovingCelState(Editor* editor, MouseMessage* msg) - : m_canceled(false) + : m_reader(UIContext::instance(), 500) + , m_canceled(false) { - ContextWriter writer(UIContext::instance(), 500); + ContextWriter writer(m_reader); Document* document = editor->document(); auto range = App::instance()->timeline()->range(); LayerImage* layer = static_cast(editor->layer()); @@ -92,7 +93,7 @@ bool MovingCelState::onMouseUp(Editor* editor, MouseMessage* msg) // If the user didn't cancel the operation... if (!m_canceled) { - ContextWriter writer(UIContext::instance(), 500); + ContextWriter writer(m_reader); Transaction transaction(writer.context(), "Cel Movement", ModifyDocument); DocumentApi api = document->getApi(transaction); diff --git a/src/app/ui/editor/moving_cel_state.h b/src/app/ui/editor/moving_cel_state.h index b96cda389..f7629dfb3 100644 --- a/src/app/ui/editor/moving_cel_state.h +++ b/src/app/ui/editor/moving_cel_state.h @@ -11,6 +11,7 @@ #include "app/ui/editor/standby_state.h" +#include "app/context_access.h" #include "doc/cel_list.h" #include @@ -34,6 +35,7 @@ namespace app { virtual bool requireBrushPreview() override { return false; } private: + ContextReader m_reader; CelList m_celList; std::vector m_celStarts; gfx::Point m_celOffset;