From: ouv Date: Tue, 9 Dec 2008 16:06:39 +0000 (+0000) Subject: Fixed bug IPAL20746 - DPE: crash on the second update study X-Git-Tag: TG_DumpPython_Extension_3_1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=af1aa2cee37b7e33202ea1e6445eb545ce127137;p=modules%2Fgui.git Fixed bug IPAL20746 - DPE: crash on the second update study --- diff --git a/src/SalomeApp/SalomeApp_NoteBookDlg.cxx b/src/SalomeApp/SalomeApp_NoteBookDlg.cxx index 446863fa2..62f1b57da 100644 --- a/src/SalomeApp/SalomeApp_NoteBookDlg.cxx +++ b/src/SalomeApp/SalomeApp_NoteBookDlg.cxx @@ -29,6 +29,7 @@ #include +#include #include #include #include @@ -936,6 +937,9 @@ bool SalomeApp_NoteBookDlg::updateStudy() // clear a study (delete all objects) clearStudy(); + // get active application + app = dynamic_cast( SUIT_Session::session()->activeApplication() ); + // load study from the temporary directory QString command = QString( "execfile(\"%1\")" ).arg( aTmpDir + QDir::separator() + aFileName + ".py" ); @@ -976,6 +980,25 @@ void SalomeApp_NoteBookDlg::clearStudy() if( !app ) return; + QList aList = SUIT_Session::session()->applications(); + int anIndex = aList.indexOf( app ); + + if( anIndex > 0 ) + setParent( 0 ); + app->onCloseDoc( false ); + + if( anIndex > 0 && anIndex < aList.count() ) + app = dynamic_cast( aList[ anIndex - 1 ] ); + + if( !app ) + return; + app->onNewDoc(); + + app = dynamic_cast( SUIT_Session::session()->activeApplication() ); + if( anIndex > 0 && app ) { + setParent( app->desktop(), Qt::Dialog ); + show(); + } }