From 21049b7c7af4735bc64a91627cd66a165454bab2 Mon Sep 17 00:00:00 2001 From: vsr Date: Wed, 2 Jun 2010 16:03:47 +0000 Subject: [PATCH] 0020892: EDF 1414: Reloading a study provokes SIGSEGV error --- src/SUIT/SUIT_Study.h | 2 +- src/SalomeApp/SalomeApp_Study.cxx | 21 ++++++++++++++++++++- src/SalomeApp/SalomeApp_Study.h | 1 + 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/SUIT/SUIT_Study.h b/src/SUIT/SUIT_Study.h index d269c0be6..bd2ec1342 100755 --- a/src/SUIT/SUIT_Study.h +++ b/src/SUIT/SUIT_Study.h @@ -48,7 +48,7 @@ public: virtual int id() const; SUIT_DataObject* root() const; - QString studyName() const; + virtual QString studyName() const; SUIT_Application* application() const; virtual bool isSaved() const; diff --git a/src/SalomeApp/SalomeApp_Study.cxx b/src/SalomeApp/SalomeApp_Study.cxx index be3b09618..019b882b4 100644 --- a/src/SalomeApp/SalomeApp_Study.cxx +++ b/src/SalomeApp/SalomeApp_Study.cxx @@ -66,11 +66,30 @@ SalomeApp_Study::~SalomeApp_Study() int SalomeApp_Study::id() const { int id = -1; - if ( myStudyDS ) + if ( studyDS() ) id = studyDS()->StudyId(); return id; } +/*! + Get study name. +*/ +QString SalomeApp_Study::studyName() const +{ + // redefined from SUIT_Study to update study name properly since + // it can be changed outside of GUI + // TEMPORARILY SOLUTION: better to be implemented with help of SALOMEDS observers + if ( studyDS() ) { + QString newName = studyDS()->Name().c_str(); + if ( LightApp_Study::studyName() != newName ) { + SalomeApp_Study* that = const_cast( this ); + that->setStudyName( newName ); + ((SalomeApp_Application*)application())->updateDesktopTitle(); + } + } + return LightApp_Study::studyName(); +} + /*! Gets studyDS pointer. */ diff --git a/src/SalomeApp/SalomeApp_Study.h b/src/SalomeApp/SalomeApp_Study.h index fe281212d..597a3e069 100644 --- a/src/SalomeApp/SalomeApp_Study.h +++ b/src/SalomeApp/SalomeApp_Study.h @@ -42,6 +42,7 @@ public: virtual ~SalomeApp_Study(); virtual int id() const; + virtual QString studyName() const; virtual bool createDocument( const QString& ); virtual bool openDocument( const QString& ); -- 2.39.2