diff Framework/Loaders/LoaderStateMachine.cpp @ 975:e75fd08d6c75 toa2019083101

Cleaning in ICallable + changed fingerprint to plain char array to allow for dead object examination + additional check in FetchContext callback to avoid the unexplained rogue callbacks I have seen + protection in LoaderStateMachine::HandleSuccessMessage in case things go wrong anyway
author Benjamin Golinvaux <bgo@osimis.io>
date Sat, 31 Aug 2019 13:45:04 +0200
parents 38409549db43
children 262a0244e9b2
line wrap: on
line diff
--- a/Framework/Loaders/LoaderStateMachine.cpp	Thu Aug 29 18:08:48 2019 +0200
+++ b/Framework/Loaders/LoaderStateMachine.cpp	Sat Aug 31 13:45:04 2019 +0200
@@ -139,19 +139,21 @@
     LOG(TRACE) << "LoaderStateMachine(" << std::hex << this << std::dec << ")::HandleSuccessMessage()";
     if (activeCommands_ <= 0) {
       LOG(ERROR) << "LoaderStateMachine(" << std::hex << this << std::dec << ")::HandleSuccessMessage : activeCommands_ should be > 0 but is: " << activeCommands_;
+      LOG(ERROR) << "LoaderStateMachine(" << std::hex << this << std::dec << ") fingerprint = " << GetFingerprint();
     }
-    activeCommands_--;
-
-    try
-    {
-      dynamic_cast<State&>(message.GetOrigin().GetPayload()).Handle(message);
-      Step();
-    }
-    catch (Orthanc::OrthancException& e)
-    {
-      LOG(ERROR) << "Error in the state machine, stopping all processing: " << 
-        e.What() << " Details: " << e.GetDetails();
-      Clear();
+    else {
+      activeCommands_--;
+      try
+      {
+        dynamic_cast<State&>(message.GetOrigin().GetPayload()).Handle(message);
+        Step();
+      }
+      catch (Orthanc::OrthancException& e)
+      {
+        LOG(ERROR) << "Error in the state machine, stopping all processing: " <<
+          e.What() << " Details: " << e.GetDetails();
+        Clear();
+      }
     }
   }