From b42caeb1c5ea15a33c4085bd2cd2bf3e61f879eb Mon Sep 17 00:00:00 2001 From: =?utf8?q?C=C3=A9dric=20Aguerre?= Date: Tue, 11 Jul 2017 11:20:22 +0200 Subject: [PATCH] Mantis 23461 - MED module exception --- src/MEDCalc/cmp/MEDPresentation.cxx | 8 +++++--- src/MEDCalc/cmp/MEDPresentationManager_i.cxx | 5 ++++- src/MEDCalc/cmp/MEDPresentationManager_i.txx | 4 +++- src/MEDCalc/gui/MEDModule.cxx | 14 +++++++------- 4 files changed, 19 insertions(+), 12 deletions(-) diff --git a/src/MEDCalc/cmp/MEDPresentation.cxx b/src/MEDCalc/cmp/MEDPresentation.cxx index 5c2ac3b9c..582a425fc 100644 --- a/src/MEDCalc/cmp/MEDPresentation.cxx +++ b/src/MEDCalc/cmp/MEDPresentation.cxx @@ -116,8 +116,11 @@ MEDPresentation::~MEDPresentation() oss << "pvs.Hide(" << _objVar << ", view=" << getRenderViewVar() << ");"; execPyLine(oss.str()); - execPyLine(getRenderViewVar() + ".ResetCamera();"); - execPyLine("pvs.Render();"); + // :TRICKY: The two following lines raise an exception when closing MED module + // after sequence: MED - load file - PARAVIS - MED - close SALOME + // (see Mantis #23461) + //execPyLine(getRenderViewVar() + ".ResetCamera();"); + //execPyLine("pvs.Render();"); } } @@ -672,4 +675,3 @@ MEDPresentation::applyCellToPointIfNeeded() // oss << _srcObjVar << ".Function = '" << _fieldName << "_0*iHat + " << _fieldName << "_1*jHat + 0.0*zHat';"; // pushAndExecPyLine(oss.str()); oss.str(""); //} - diff --git a/src/MEDCalc/cmp/MEDPresentationManager_i.cxx b/src/MEDCalc/cmp/MEDPresentationManager_i.cxx index 134ada1b5..50ed29bb9 100644 --- a/src/MEDCalc/cmp/MEDPresentationManager_i.cxx +++ b/src/MEDCalc/cmp/MEDPresentationManager_i.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2011-2016 CEA/DEN, EDF R&D +// Copyright (C) 2011-2017 CEA/DEN, EDF R&D // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -73,6 +73,7 @@ MEDPresentationManager_i::GenerateID() MEDPresentation* MEDPresentationManager_i::_getPresentation(MEDPresentation::TypeID presentationID) const { + STDLOG("Get presentation " << presentationID); std::map::const_iterator citr = _presentations.find(presentationID); if (citr == _presentations.end()) return NULL; @@ -271,6 +272,7 @@ MEDPresentationManager_i::updatePointSprite(MEDPresentation::TypeID presentation CORBA::Boolean MEDPresentationManager_i::removePresentation(MEDPresentation::TypeID presentationID) { + STDLOG("Remove presentation " << presentationID); std::map::const_iterator citr = _presentations.find(presentationID); if (citr == _presentations.end()) { std::cerr << "removePresentation(): presentation not found!!" << std::endl; @@ -360,6 +362,7 @@ MEDPresentationManager_i::getAllPresentations() void MEDPresentationManager_i::cleanUp() { + STDLOG("Cleanup"); _activeViewPythonId = -1; std::map::iterator it; for (it = _presentations.begin(); it != _presentations.end(); ++it) diff --git a/src/MEDCalc/cmp/MEDPresentationManager_i.txx b/src/MEDCalc/cmp/MEDPresentationManager_i.txx index e4b6cf8e9..8aee5e8da 100644 --- a/src/MEDCalc/cmp/MEDPresentationManager_i.txx +++ b/src/MEDCalc/cmp/MEDPresentationManager_i.txx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2016 CEA/DEN, EDF R&D +// Copyright (C) 2007-2017 CEA/DEN, EDF R&D // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -61,6 +61,7 @@ MEDPresentationManager_i::_makePresentation(const PresentationParameters params, return -1; } + STDLOG("Add new presentation " << newID); _presentations.insert( std::pair(newID, presentation) ); presentation->generatePipeline(); @@ -78,6 +79,7 @@ template void MEDPresentationManager_i::_updatePresentation(MEDPresentation::TypeID presentationID, const PresentationParameters params) { + STDLOG("Update presentation " << presentationID); MEDPresentation* presentation = _getPresentation(presentationID); if (!presentation) { std::cerr << "_updatePresentation(): presentation not found!!" << std::endl; diff --git a/src/MEDCalc/gui/MEDModule.cxx b/src/MEDCalc/gui/MEDModule.cxx index ebadeaa4e..8a6134478 100644 --- a/src/MEDCalc/gui/MEDModule.cxx +++ b/src/MEDCalc/gui/MEDModule.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2016 CEA/DEN, EDF R&D +// Copyright (C) 2007-2017 CEA/DEN, EDF R&D // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -70,6 +70,12 @@ MEDModule::MEDModule() : MEDModule::~MEDModule() { + // Clean up engine: + STDLOG("MEDModule::~MEDModule(): cleaning up engine side."); + _MED_engine->cleanUp(); + MEDFactoryClient::getFactory()->getPresentationManager()->cleanUp(); + MEDFactoryClient::getFactory()->getDataManager()->cleanUp(); + if (_studyEditor) delete _studyEditor; if (_datasourceController) @@ -222,12 +228,6 @@ MEDModule::activateModule( SUIT_Study* theStudy ) bool MEDModule::deactivateModule( SUIT_Study* theStudy ) { - // Clean up engine: - STDLOG("MEDModule::deactivateModule(): cleaning up engine side."); - _MED_engine->cleanUp(); - MEDFactoryClient::getFactory()->getPresentationManager()->cleanUp(); - MEDFactoryClient::getFactory()->getDataManager()->cleanUp(); - _workspaceController->showDockWidgets(false); _presentationController->showDockWidgets(false); //this->unsetDockLayout(); -- 2.39.2