Salome HOME
Delete desktop in destructor.
authorstv <stv@opencascade.com>
Mon, 21 Nov 2005 12:38:04 +0000 (12:38 +0000)
committerstv <stv@opencascade.com>
Mon, 21 Nov 2005 12:38:04 +0000 (12:38 +0000)
src/SUIT/SUIT_Application.cxx

index b0b1cd9d6a42d012ecff0b1262e60229d30fe509..816f8d41f948fb83c66e70091b36e94f02b699c2 100755 (executable)
@@ -24,6 +24,8 @@ SUIT_Application::~SUIT_Application()
 {
   delete myStudy;
   myStudy = 0;
+
+  setDesktop( 0 );
 }
 
 SUIT_Desktop* SUIT_Application::desktop()
@@ -60,9 +62,17 @@ void SUIT_Application::start()
 bool SUIT_Application::useFile( const QString& theFileName )
 {
   createEmptyStudy();
-  if ( activeStudy() )
-    return activeStudy()->openDocument( theFileName );
-  return false;
+  SUIT_Study* study = activeStudy();
+
+  bool status = study ? study->openDocument( theFileName ) : false;
+
+  if ( !status )
+  {
+    setActiveStudy( 0 );
+    delete study;
+  }
+
+  return status;
 }
 
 bool SUIT_Application::useStudy( const QString& theName )