From: jfa Date: Wed, 24 Oct 2007 12:40:58 +0000 (+0000) Subject: Fix pb. with opening a sequential file in a second study. X-Git-Tag: mergeto_BR_Dev_For_4_0_29Oct07~2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=6f7a1a0bf9180c57184da6448e8c51ff1b30ef38;p=modules%2Fmultipr.git Fix pb. with opening a sequential file in a second study. --- diff --git a/src/MULTIPRGUI/MULTIPR_GUI.cxx b/src/MULTIPRGUI/MULTIPR_GUI.cxx index 586edc6..1ca14be 100644 --- a/src/MULTIPRGUI/MULTIPR_GUI.cxx +++ b/src/MULTIPRGUI/MULTIPR_GUI.cxx @@ -182,7 +182,7 @@ MULTIPR_ORB::MULTIPR_Gen_ptr GetMultiprGen (const CAM_Module* theModule) MULTIPR_GUI::MULTIPR_GUI() : SalomeApp_Module("MULTIPR"), - mMULTIPRObj(NULL), + //mMULTIPRObj(NULL), mMEDFileName(""), mProgress(NULL) { @@ -193,7 +193,8 @@ MULTIPR_GUI::MULTIPR_GUI() MULTIPR_GUI::~MULTIPR_GUI() { - if (mMULTIPRObj != NULL) + //if (mMULTIPRObj != NULL) + if (!CORBA::is_nil(mMULTIPRObj)) { CORBA::release(mMULTIPRObj); } @@ -372,14 +373,16 @@ bool MULTIPR_GUI::deactivateModule(SUIT_Study* theStudy) { setMenuShown(false); setToolShown(false); - + // Unset actions accelerator keys action(ACTION_IMPORT_MED)->setAccel(QKeySequence()); - + + mMULTIPRObj = MULTIPR_ORB::MULTIPR_Obj::_nil(); + return SalomeApp_Module::deactivateModule(theStudy); } - + void MULTIPR_GUI::windows(QMap& theMap) const { theMap.clear(); @@ -444,7 +447,8 @@ void MULTIPR_GUI::OnImportFromMEDFile() QApplication::setOverrideCursor(Qt::waitCursor); // Delete previous MULTIPR object. - if (mMULTIPRObj != NULL) + //if (mMULTIPRObj != NULL) + if (!CORBA::is_nil(mMULTIPRObj) && !mMULTIPRObj->_non_existent()) { mMULTIPRObj->reset(); } @@ -465,7 +469,8 @@ void MULTIPR_GUI::OnImportFromMEDFile() } QApplication::restoreOverrideCursor(); - if (mMULTIPRObj != NULL) + //if (mMULTIPRObj != NULL) + if (!CORBA::is_nil(mMULTIPRObj)) { SALOMEDS::SObject_ptr aSObject = SALOMEDS::SObject::_nil(); SalomeApp_Study* aSAStudy = dynamic_cast(getApp()->activeStudy()); @@ -493,7 +498,8 @@ void MULTIPR_GUI::OnImportFromMEDFile() void MULTIPR_GUI::OnPartition1() { // check if MULTIPRObj exists - if (mMULTIPRObj == NULL) + //if (mMULTIPRObj == NULL) + if (CORBA::is_nil(mMULTIPRObj)) { return; } @@ -548,7 +554,8 @@ void MULTIPR_GUI::OnPartition1() void MULTIPR_GUI::OnPartition2() { // check if MULTIPRObj exists - if (mMULTIPRObj == NULL) + //if (mMULTIPRObj == NULL) + if (CORBA::is_nil(mMULTIPRObj)) { return; } @@ -581,7 +588,8 @@ void MULTIPR_GUI::OnPartition2() void MULTIPR_GUI::OnDecimate() { // check if MULTIPRObj exists - if (mMULTIPRObj == NULL) + //if (mMULTIPRObj == NULL) + if (CORBA::is_nil(mMULTIPRObj)) { return; } @@ -627,7 +635,8 @@ void MULTIPR_GUI::OnDecimate() void MULTIPR_GUI::OnRemove() { // check if MULTIPRObj exists - if (mMULTIPRObj == NULL) + //if (mMULTIPRObj == NULL) + if (CORBA::is_nil(mMULTIPRObj)) { return; } @@ -685,7 +694,8 @@ void MULTIPR_GUI::OnRemove() void MULTIPR_GUI::OnSave() { // check if MULTIPRObj exists - if (mMULTIPRObj == NULL) + //if (mMULTIPRObj == NULL) + if (CORBA::is_nil(mMULTIPRObj)) { return; } @@ -762,7 +772,8 @@ void MULTIPR_GUI::retrieveSelectedParts() bool MULTIPR_GUI::isPartExist(const char* partName) { - if (mMULTIPRObj == NULL) return false; + //if (mMULTIPRObj == NULL) return false; + if (CORBA::is_nil(mMULTIPRObj)) return false; MULTIPR_ORB::string_array* listParts = mMULTIPRObj->getParts(); for (int i=0 ; ilength() ; i++) diff --git a/src/MULTIPRGUI/MULTIPR_GUI.h b/src/MULTIPRGUI/MULTIPR_GUI.h index a63dfec..6fccaf9 100644 --- a/src/MULTIPRGUI/MULTIPR_GUI.h +++ b/src/MULTIPRGUI/MULTIPR_GUI.h @@ -121,7 +121,8 @@ private: QString mMEDFileName; QStringList mSelectedParts; - MULTIPR_ORB::MULTIPR_Obj_ptr mMULTIPRObj; + //MULTIPR_ORB::MULTIPR_Obj_ptr mMULTIPRObj; + MULTIPR_ORB::MULTIPR_Obj_var mMULTIPRObj; QProgressDialog* mProgress; //MULTIPR_GUI_ProgressCallbackDlg* mProgress;