From 3066bd6dbaa977aca6e6359ec2dc1dcfc47987a5 Mon Sep 17 00:00:00 2001 From: stv Date: Mon, 21 Nov 2005 12:38:04 +0000 Subject: [PATCH] Delete desktop in destructor. --- src/SUIT/SUIT_Application.cxx | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/SUIT/SUIT_Application.cxx b/src/SUIT/SUIT_Application.cxx index b0b1cd9d6..816f8d41f 100755 --- a/src/SUIT/SUIT_Application.cxx +++ b/src/SUIT/SUIT_Application.cxx @@ -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 ) -- 2.39.2