From 2e305d9260f4e150955f25e570838fd45952f2cb Mon Sep 17 00:00:00 2001 From: sbh Date: Tue, 8 Apr 2014 18:41:44 +0400 Subject: [PATCH] Creation of feature moved from constructor into "startOperation" method. --- src/ModuleBase/ModuleBase_Operation.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/ModuleBase/ModuleBase_Operation.cpp b/src/ModuleBase/ModuleBase_Operation.cpp index b3250ff01..1fc489795 100644 --- a/src/ModuleBase/ModuleBase_Operation.cpp +++ b/src/ModuleBase/ModuleBase_Operation.cpp @@ -13,6 +13,10 @@ #include #include +#ifdef _DEBUG +#include +#endif + /*! \brief Constructor \param XGUI_Workshop - workshop for this operation @@ -29,7 +33,6 @@ ModuleBase_Operation::ModuleBase_Operation(const QString& theId, QObject* parent myExecStatus(Rejected), myOperationId(theId) { - myFeature = ModelAPI_PluginManager::get()->createFeature(theId.toStdString()); } /*! @@ -251,6 +254,13 @@ void ModuleBase_Operation::commit() */ void ModuleBase_Operation::storeReal(double theValue) { + if(!myFeature){ + #ifdef _DEBUG + qDebug() << "ModuleBase_Operation::storeReal: " << + "trying to store value without opening a transaction."; + #endif + return; + } QString anId = sender()->objectName(); std::shared_ptr aData = myFeature->data(); std::shared_ptr aReal = aData->real(anId.toStdString()); @@ -276,6 +286,7 @@ bool ModuleBase_Operation::isReadyToStart() const */ void ModuleBase_Operation::startOperation() { + myFeature = ModelAPI_PluginManager::get()->createFeature(myOperationId.toStdString()); //emit callSlot(); //commit(); } -- 2.39.2