Mercurial > hg > orthanc-stone
comparison Framework/Messages/IObserver.h @ 977:262a0244e9b2 toa2019090201
Added missing Unregister for objects that register by the broker + logs + guard in FetchContext
author | Benjamin Golinvaux <bgo@osimis.io> |
---|---|
date | Mon, 02 Sep 2019 17:29:26 +0200 |
parents | e75fd08d6c75 |
children | 92a043b8e431 |
comparison
equal
deleted
inserted
replaced
976:3abc47e051c8 | 977:262a0244e9b2 |
---|---|
52 broker_.Register(*this); | 52 broker_.Register(*this); |
53 } | 53 } |
54 | 54 |
55 virtual ~IObserver() | 55 virtual ~IObserver() |
56 { | 56 { |
57 LOG(TRACE) << "IObserver(" << std::hex << this << std::dec << ")::~IObserver : fingerprint_ == " << fingerprint_; | 57 try |
58 broker_.Unregister(*this); | 58 { |
59 LOG(TRACE) << "IObserver(" << std::hex << this << std::dec << ")::~IObserver : fingerprint_ == " << fingerprint_; | |
60 const char* deadMarker = "deadbeef-dead-dead-0000-0000deadbeef"; | |
61 ORTHANC_ASSERT(strlen(deadMarker) == 36); | |
62 memcpy(fingerprint_, deadMarker, 37); | |
63 broker_.Unregister(*this); | |
64 } | |
65 catch (const Orthanc::OrthancException& e) | |
66 { | |
67 if (e.HasDetails()) | |
68 { | |
69 LOG(ERROR) << "OrthancException in ~IObserver: " << e.What() << " Details: " << e.GetDetails(); | |
70 } | |
71 else | |
72 { | |
73 LOG(ERROR) << "OrthancException in ~IObserver: " << e.What(); | |
74 } | |
75 } | |
76 catch (const std::exception& e) | |
77 { | |
78 LOG(ERROR) << "std::exception in ~IObserver: " << e.what(); | |
79 } | |
80 catch (...) | |
81 { | |
82 LOG(ERROR) << "Unknown exception in ~IObserver"; | |
83 } | |
59 } | 84 } |
60 | 85 |
61 const char* GetFingerprint() const | 86 const char* GetFingerprint() const |
62 { | 87 { |
63 return fingerprint_; | 88 return fingerprint_; |