From 5aed93b51831f39ee967c5dafa2d848b9a3b4114 Mon Sep 17 00:00:00 2001 From: jfa Date: Mon, 3 Oct 2005 13:01:36 +0000 Subject: [PATCH] Provide correct static variable management to avoid problems, appering if SMESHGUI is loaded from python script before module activation via GUI --- src/SMESHGUI/SMESHGUI.cxx | 1 + src/SMESHGUI/SMESHGUI_FilterLibraryDlg.cxx | 2 +- src/SMESHGUI/SMESHGUI_FilterUtils.cxx | 8 +++++--- src/SMESHGUI/SMESHGUI_FilterUtils.h | 2 +- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/SMESHGUI/SMESHGUI.cxx b/src/SMESHGUI/SMESHGUI.cxx index d481b7d9c..17f9fdc9b 100644 --- a/src/SMESHGUI/SMESHGUI.cxx +++ b/src/SMESHGUI/SMESHGUI.cxx @@ -824,6 +824,7 @@ SalomeApp_Module( "SMESH" ) SMESHGUI::~SMESHGUI() { SMESH::GetFilterManager()->Destroy(); + SMESH::GetFilterManager() = SMESH::FilterManager::_nil(); } //============================================================================= diff --git a/src/SMESHGUI/SMESHGUI_FilterLibraryDlg.cxx b/src/SMESHGUI/SMESHGUI_FilterLibraryDlg.cxx index c4ca04c37..8ea1769f9 100644 --- a/src/SMESHGUI/SMESHGUI_FilterLibraryDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_FilterLibraryDlg.cxx @@ -1041,7 +1041,7 @@ void SMESHGUI_FilterLibraryDlg::onDeleteBtnPressed() tr("ERROR_OF_DELETING"), QMessageBox::Ok); } else { myCurrFilterName = ""; - myCurrFilterName = -1; + myCurrFilter = -1; myListBox->removeItem(anIndex); if (anIndex >= 1) diff --git a/src/SMESHGUI/SMESHGUI_FilterUtils.cxx b/src/SMESHGUI/SMESHGUI_FilterUtils.cxx index 360d00486..e5c529f16 100644 --- a/src/SMESHGUI/SMESHGUI_FilterUtils.cxx +++ b/src/SMESHGUI/SMESHGUI_FilterUtils.cxx @@ -22,13 +22,15 @@ #include "SMESHGUI.h" +#include "utilities.h" + namespace SMESH { - SMESH::FilterManager_var GetFilterManager() + SMESH::FilterManager_var& GetFilterManager() { static SMESH::FilterManager_var aFilterManager; - if (CORBA::is_nil(aFilterManager)){ - aFilterManager = SMESHGUI::GetSMESHGen()->CreateFilterManager(); + if (CORBA::is_nil(aFilterManager)) { + aFilterManager = SMESHGUI::GetSMESHGen()->CreateFilterManager(); } return aFilterManager; } diff --git a/src/SMESHGUI/SMESHGUI_FilterUtils.h b/src/SMESHGUI/SMESHGUI_FilterUtils.h index 85bd3d01a..6b8c75862 100644 --- a/src/SMESHGUI/SMESHGUI_FilterUtils.h +++ b/src/SMESHGUI/SMESHGUI_FilterUtils.h @@ -26,7 +26,7 @@ namespace SMESH{ - SMESH::FilterManager_var GetFilterManager(); + SMESH::FilterManager_var& GetFilterManager(); } -- 2.39.2