From a30cf5b4df22cf43f58211210b70183a7d6c17aa Mon Sep 17 00:00:00 2001 From: wmayer Date: Sun, 7 Feb 2021 17:43:36 +0100 Subject: [PATCH] App: make sure to also call a feature's extensions when recomputing it --- src/App/DocumentObject.cpp | 16 +++++++++++++++- src/App/DocumentObject.h | 1 + 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/App/DocumentObject.cpp b/src/App/DocumentObject.cpp index 0d83902543..fe929c3152 100644 --- a/src/App/DocumentObject.cpp +++ b/src/App/DocumentObject.cpp @@ -108,7 +108,20 @@ App::DocumentObjectExecReturn *DocumentObject::recompute(void) // set/unset the execution bit Base::ObjectStatusLocker exe(App::Recompute, this); - return this->execute(); + + // mark the object to recompute its extensions + this->setStatus(App::RecomputeExtension, true); + + auto ret = this->execute(); + if (ret == StdReturn) { + // most feature classes don't call the execute() method of its base class + // so execute the extensions now + if (this->testStatus(App::RecomputeExtension)) { + ret = executeExtensions(); + } + } + + return ret; } DocumentObjectExecReturn *DocumentObject::execute(void) @@ -119,6 +132,7 @@ DocumentObjectExecReturn *DocumentObject::execute(void) App::DocumentObjectExecReturn* DocumentObject::executeExtensions() { //execute extensions but stop on error + this->setStatus(App::RecomputeExtension, false); // reset the flag auto vector = getExtensionsDerivedFromType(); for(auto ext : vector) { auto ret = ext->extensionExecute(); diff --git a/src/App/DocumentObject.h b/src/App/DocumentObject.h index e9f32386e8..b4b166075f 100644 --- a/src/App/DocumentObject.h +++ b/src/App/DocumentObject.h @@ -65,6 +65,7 @@ enum ObjectStatus { Expand = 16, // indicate the object's tree item expansion status NoAutoExpand = 17, // disable tree item auto expand on selection for this object PendingTransactionUpdate = 18, // mark that the object expects a call to onUndoRedoFinished() after transaction is finished. + RecomputeExtension = 19, // mark the object to recompute its extensions }; /** Return object for feature execution