App: [skip ci] fix possible segmentation fault when performing a transaction after an undo
This commit is contained in:
@@ -178,6 +178,7 @@ struct DocumentP
|
||||
bool rollback;
|
||||
bool undoing; ///< document in the middle of undo or redo
|
||||
bool committing;
|
||||
bool opentransaction;
|
||||
std::bitset<32> StatusBits;
|
||||
int iUndoMode;
|
||||
unsigned int UndoMemSize;
|
||||
@@ -205,6 +206,7 @@ struct DocumentP
|
||||
rollback = false;
|
||||
undoing = false;
|
||||
committing = false;
|
||||
opentransaction = false;
|
||||
StatusBits.set((size_t)Document::Closable, true);
|
||||
StatusBits.set((size_t)Document::KeepTrailingDigits, true);
|
||||
StatusBits.set((size_t)Document::Restoring, false);
|
||||
@@ -1101,6 +1103,14 @@ int Document::_openTransaction(const char* name, int id)
|
||||
}
|
||||
|
||||
if (d->iUndoMode) {
|
||||
// Avoid recursive calls that is possible while
|
||||
// clearing the redo transactions and will cause
|
||||
// a double deletion of some transaction and thus
|
||||
// a segmentation fault
|
||||
if (d->opentransaction)
|
||||
return 0;
|
||||
Base::FlagToggler<> flag(d->opentransaction);
|
||||
|
||||
if(id && mUndoMap.find(id)!=mUndoMap.end())
|
||||
throw Base::RuntimeError("invalid transaction id");
|
||||
if (d->activeUndoTransaction)
|
||||
|
||||
Reference in New Issue
Block a user