Block the document in MovingCelState so other commands cannot modify it (fix #1078)

This commit is contained in:
David Capello 2016-04-28 15:00:15 -03:00
parent 4b7eb54511
commit becdd90789
2 changed files with 6 additions and 3 deletions

View File

@ -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<LayerImage*>(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);

View File

@ -11,6 +11,7 @@
#include "app/ui/editor/standby_state.h"
#include "app/context_access.h"
#include "doc/cel_list.h"
#include <vector>
@ -34,6 +35,7 @@ namespace app {
virtual bool requireBrushPreview() override { return false; }
private:
ContextReader m_reader;
CelList m_celList;
std::vector<gfx::Point> m_celStarts;
gfx::Point m_celOffset;