App: add class TransactionLocker

To protect some critical transaction from being closed prematurely. It
is currently used to protect transaction of object deletion.
This commit is contained in:
Zheng, Lei
2020-02-04 09:49:49 +08:00
committed by WandererFan
parent 5b3c63c9be
commit b50914923a
4 changed files with 127 additions and 2 deletions

View File

@@ -91,6 +91,7 @@ recompute path. Also, it enables more complicated dependencies beyond trees.
#include <QCoreApplication>
#include <QCryptographicHash>
#include "AutoTransaction.h"
#include "Document.h"
#include "Application.h"
#include "DocumentObject.h"
@@ -3764,6 +3765,8 @@ void Document::removeObject(const char* sName)
return;
}
TransactionLocker tlock;
_checkTransaction(pos->second,0,__LINE__);
#if 0
@@ -3865,6 +3868,8 @@ void Document::_removeObject(DocumentObject* pcObject)
return;
}
TransactionLocker tlock;
// TODO Refactoring: share code with Document::removeObject() (2015-09-01, Fat-Zer)
_checkTransaction(pcObject,0,__LINE__);