MCPcopy Create free account
hub / github.com/FreeCAD/FreeCAD / _commitTransaction

Method _commitTransaction

src/App/Document.cpp:588–631  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

586}
587
588bool Document::_commitTransaction(const bool notify)
589{
590 if (isPerformingTransaction()) {
591 if (FC_LOG_INSTANCE.isEnabled(FC_LOGLEVEL_LOG)) {
592 FC_WARN("Cannot commit transaction while transacting");
593 }
594 return false;
595 }
596 if (d->committing) {
597 // for a recursive call return without printing a warning
598 return false;
599 }
600
601 d->bookedTransaction = 0;
602 bool committed = false;
603 if (d->activeUndoTransaction) {
604 {
605 Base::FlagToggler<> flag(d->committing);
606 Application::TransactionSignaller signaller(false, true);
607 const int id = d->activeUndoTransaction->getID();
608
609 mUndoTransactions.push_back(d->activeUndoTransaction);
610 d->activeUndoTransaction = nullptr;
611
612 // check the stack for the limits
613 if (mUndoTransactions.size() > d->UndoMaxStackSize) {
614 mUndoMap.erase(mUndoTransactions.front()->getID());
615 delete mUndoTransactions.front();
616 mUndoTransactions.pop_front();
617 }
618 signalCommitTransaction(*this);
619
620 // commitTransaction() may call again _commitTransaction()
621 if (notify) {
622 GetApplication().commitTransaction(id);
623 }
624 }
625 committed = true;
626 }
627 if (committed) {
628 signalBecameStable(*this);
629 }
630 return true;
631}
632
633void Document::abortTransaction() const
634{

Callers 1

Calls 7

isEnabledMethod · 0.45
getIDMethod · 0.45
push_backMethod · 0.45
sizeMethod · 0.45
eraseMethod · 0.45
frontMethod · 0.45
commitTransactionMethod · 0.45

Tested by

no test coverage detected