Browse Source

Do not try to exit app which has already exited unexpectedly

Ivo Wolf 13 years ago
parent
commit
cb7119c0b0
1 changed files with 9 additions and 6 deletions
  1. 9 6
      Plugins/org.commontk.dah.examplehost/ctkExampleDicomHost.cpp

+ 9 - 6
Plugins/org.commontk.dah.examplehost/ctkExampleDicomHost.cpp

@@ -175,14 +175,17 @@ void ctkExampleDicomHost::onReleaseAvailableResources()
 void ctkExampleDicomHost::exitApplication()
 {
   this->exitingApplication=true;
-  if(this->getApplicationState() == ctkDicomAppHosting::EXIT)
-    return;
-  if(this->getApplicationState() == ctkDicomAppHosting::IDLE)
+  if(this->getAppProcess().state() == QProcess::Running)
   {
-    getDicomAppService ()->setState (ctkDicomAppHosting::EXIT);
-    return;
+    if(this->getApplicationState() == ctkDicomAppHosting::EXIT)
+      return;
+    if(this->getApplicationState() == ctkDicomAppHosting::IDLE)
+    {
+      getDicomAppService ()->setState (ctkDicomAppHosting::EXIT);
+      return;
+    }
+    getDicomAppService ()->setState (ctkDicomAppHosting::CANCELED);
   }
-  getDicomAppService ()->setState (ctkDicomAppHosting::CANCELED);
 }
 
 //----------------------------------------------------------------------------