fix crash when saving a document after aborting a pending transaction
This commit is contained in:
parent
9ef81d7d56
commit
6e284fc9ea
|
@ -2135,6 +2135,10 @@ void Document::_remObject(DocumentObject* pcObject)
|
|||
d->activeUndoTransaction->addObjectNew(pcObject);
|
||||
}
|
||||
}
|
||||
else {
|
||||
// for a rollback delete the object
|
||||
signalTransactionRemove(*pcObject, 0);
|
||||
}
|
||||
|
||||
// remove from map
|
||||
d->objectMap.erase(pos);
|
||||
|
@ -2145,6 +2149,11 @@ void Document::_remObject(DocumentObject* pcObject)
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// for a rollback delete the object
|
||||
if (d->rollback) {
|
||||
delete pcObject;
|
||||
}
|
||||
}
|
||||
|
||||
void Document::breakDependency(DocumentObject* pcObject, bool clear)
|
||||
|
|
|
@ -494,6 +494,10 @@ Offset::Offset()
|
|||
ADD_PROPERTY_TYPE(Fill,(false),"Offset",App::Prop_None,"Fill offset");
|
||||
}
|
||||
|
||||
Offset::~Offset()
|
||||
{
|
||||
}
|
||||
|
||||
short Offset::mustExecute() const
|
||||
{
|
||||
if (Source.isTouched())
|
||||
|
|
|
@ -121,6 +121,7 @@ class Offset : public Part::Feature
|
|||
|
||||
public:
|
||||
Offset();
|
||||
~Offset();
|
||||
|
||||
App::PropertyLink Source;
|
||||
App::PropertyFloat Value;
|
||||
|
|
|
@ -56,6 +56,14 @@ class DocumentBasicCases(unittest.TestCase):
|
|||
self.Doc.undo()
|
||||
self.Doc.undo()
|
||||
|
||||
def testAbortTransaction(self):
|
||||
self.Doc.openTransaction("Add")
|
||||
obj=self.Doc.addObject("App::FeatureTest","Label")
|
||||
self.Doc.abortTransaction()
|
||||
TempPath = tempfile.gettempdir()
|
||||
SaveName = TempPath + os.sep + "SaveRestoreTests.FCStd"
|
||||
self.Doc.saveAs(SaveName)
|
||||
|
||||
def testRemoval(self):
|
||||
# Cannot write a real test case for that but when debugging the
|
||||
# C-code there shouldn't be a memory leak (see rev. 1814)
|
||||
|
|
Loading…
Reference in New Issue
Block a user