diff OrthancServer/DicomProtocol/DicomServer.cpp @ 1193:e95e7f9eba96

fix crash when stopping Orthanc during a DICOM connection
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 20 Oct 2014 16:46:40 +0200
parents 816dccaeb7cf
children a65ad39596cb
line wrap: on
line diff
--- a/OrthancServer/DicomProtocol/DicomServer.cpp	Thu Oct 16 11:24:03 2014 +0200
+++ b/OrthancServer/DicomProtocol/DicomServer.cpp	Mon Oct 20 16:46:40 2014 +0200
@@ -190,6 +190,11 @@
 
     LOG(INFO) << "DICOM server stopping";
 
+    if (server->isThreaded_)
+    {
+      server->bagOfDispatchers_.StopAll();
+    }
+
     /* drop the network, i.e. free memory of T_ASC_Network* structure. This call */
     /* is the counterpart of ASC_initializeNetwork(...) which was called above. */
     cond = ASC_dropNetwork(&net);
@@ -403,8 +408,6 @@
     {
       pimpl_->thread_.join();
     }
-
-    bagOfDispatchers_.StopAll();
   }
 
   bool DicomServer::IsMyAETitle(const std::string& aet) const