From 26abbbce567bd05417b13ffc3d6e7563a28f2f88 Mon Sep 17 00:00:00 2001 From: rnv Date: Thu, 17 Nov 2016 16:15:27 +0300 Subject: [PATCH] Fix for the '23377: EDF 13481 PARAVIS: SIGSEGV exiting SALOME/PARAVIS' issue. --- src/PVViewer/PVViewer_ViewWindow.cxx | 10 ++++++++++ src/PVViewer/PVViewer_ViewWindow.h | 2 ++ src/SUIT/SUIT_Application.cxx | 12 +++++++++++- src/SUIT/SUIT_Application.h | 5 +++++ 4 files changed, 28 insertions(+), 1 deletion(-) mode change 100755 => 100644 src/SUIT/SUIT_Application.cxx mode change 100755 => 100644 src/SUIT/SUIT_Application.h diff --git a/src/PVViewer/PVViewer_ViewWindow.cxx b/src/PVViewer/PVViewer_ViewWindow.cxx index 7b415c1ce..f26f9a745 100644 --- a/src/PVViewer/PVViewer_ViewWindow.cxx +++ b/src/PVViewer/PVViewer_ViewWindow.cxx @@ -28,6 +28,7 @@ #include #include #include +#include #include #include @@ -51,6 +52,9 @@ PVViewer_ViewWindow::PVViewer_ViewWindow( SUIT_Desktop* theDesktop, PVViewer_Vie setViewManager(myModel->getViewManager()); myPVMgr = qobject_cast(pqApplicationCore::instance()->manager("MULTIVIEW_WIDGET")); if (myPVMgr) { + SUIT_Application* app = SUIT_Session::session()->activeApplication(); + if ( app ) + app->addPostRoutine(&PVViewer_ViewWindow::removePVMgr); myPVMgr->setParent( this ); // This is mandatory, see setParent() method in Qt 4 documentation myPVMgr->show(); @@ -88,6 +92,12 @@ PVViewer_ViewWindow::~PVViewer_ViewWindow() } } +void PVViewer_ViewWindow::removePVMgr() +{ + pqTabbedMultiViewWidget* aPVMgr = qobject_cast(pqApplicationCore::instance()->manager("MULTIVIEW_WIDGET")); + delete aPVMgr; +} + /*! \brief Get the visual parameters of the view window. \return visual parameters of this view window formatted to the string diff --git a/src/PVViewer/PVViewer_ViewWindow.h b/src/PVViewer/PVViewer_ViewWindow.h index 887a0b119..4f8633f9e 100644 --- a/src/PVViewer/PVViewer_ViewWindow.h +++ b/src/PVViewer/PVViewer_ViewWindow.h @@ -44,6 +44,8 @@ public: pqTabbedMultiViewWidget* getMultiViewManager() const; + static void removePVMgr(); + private: SUIT_Desktop* myDesktop; PVViewer_Viewer* myModel; diff --git a/src/SUIT/SUIT_Application.cxx b/src/SUIT/SUIT_Application.cxx old mode 100755 new mode 100644 index 95a42da89..75d32cfc6 --- a/src/SUIT/SUIT_Application.cxx +++ b/src/SUIT/SUIT_Application.cxx @@ -58,7 +58,8 @@ SUIT_Application::SUIT_Application() : QObject( 0 ), myStudy( 0 ), myDesktop( 0 ), - myStatusLabel( 0 ) + myStatusLabel( 0 ), + myPostRoutines( QList() ) { if ( SUIT_Session::session() ) SUIT_Session::session()->insertApplication( this ); @@ -74,6 +75,9 @@ SUIT_Application::~SUIT_Application() delete s; setDesktop( 0 ); + + foreach ( PostRoutine routine, myPostRoutines ) + routine(); } /*! @@ -727,3 +731,9 @@ void SUIT_Application::onHelpContextModule( const QString& /*theComponentName*/, const QString& /*theContext*/ ) { } + +void SUIT_Application::addPostRoutine( PostRoutine theRoutine ) +{ + if ( !myPostRoutines.contains( theRoutine ) ) + myPostRoutines << theRoutine; +} diff --git a/src/SUIT/SUIT_Application.h b/src/SUIT/SUIT_Application.h old mode 100755 new mode 100644 index a9225c3f9..3722c93d7 --- a/src/SUIT/SUIT_Application.h +++ b/src/SUIT/SUIT_Application.h @@ -116,6 +116,8 @@ public: virtual void viewManagers( const QString&, QList& ) const = 0; QAction* action( const int ) const; + void addPostRoutine( void (*theRoutine)() ); + signals: void applicationClosed( SUIT_Application* ); void activated( SUIT_Application* ); @@ -191,6 +193,9 @@ private: SUIT_ShortcutMgr* myShortcutMgr; QLabel* myStatusLabel; + + typedef void (*PostRoutine)(); + QList myPostRoutines; }; //! This function must return a new application instance. -- 2.30.2