Lock the document when ToolLoopImpl has to commit or rollback the change

This commit is contained in:
David Capello 2015-04-07 17:50:57 -03:00
parent 14fed8afd5
commit 5f587af503

View File

@ -190,7 +190,16 @@ public:
if (!m_canceled) {
// Paint ink
if (getInk()->isPaint()) {
m_expandCelCanvas.commit();
retry_commit:;
try {
ContextReader reader(m_context);
ContextWriter writer(reader);
m_expandCelCanvas.commit();
}
catch (const LockedDocumentException&) {
base::this_thread::sleep_for(0.25);
goto retry_commit;
}
}
// Selection ink
else if (getInk()->isSelection()) {
@ -205,7 +214,16 @@ public:
// If the trace was canceled or it is not a 'paint' ink...
if (m_canceled || !getInk()->isPaint()) {
m_expandCelCanvas.rollback();
retry_rollback:;
try {
ContextReader reader(m_context);
ContextWriter writer(reader);
m_expandCelCanvas.rollback();
}
catch (const LockedDocumentException&) {
base::this_thread::sleep_for(0.25);
goto retry_rollback;
}
}
delete m_brush;