comparison Framework/Messages/ICallable.h @ 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
comparison
equal deleted inserted replaced
974:e4b028c1ede1 975:e75fd08d6c75
76 { 76 {
77 } 77 }
78 78
79 void ApplyInternal(const TMessage& message) 79 void ApplyInternal(const TMessage& message)
80 { 80 {
81 #if 0
82 (observer_.*function_) (message);
83 #else
84 if (observerFingerprint_ != observer_.GetFingerprint()) 81 if (observerFingerprint_ != observer_.GetFingerprint())
85 { 82 {
86 LOG(WARNING) << "The observer at address " << std::hex << &observer_ << std::dec << ") has a different fingerprint than the one recorded at callback registration time. Callback will NOT be sent!"; 83 LOG(TRACE) << "The observer at address " << std::hex << &observer_ << std::dec << ") has a different fingerprint than the one recorded at callback registration time. This means that it is not the same object as the one recorded, even though their addresses are the same. Callback will NOT be sent!";
87 LOG(WARNING) << " recorded fingerprint = " << observerFingerprint_ << " current fingerprint = " << observer_.GetFingerprint(); 84 LOG(TRACE) << " recorded fingerprint = " << observerFingerprint_ << " current fingerprint = " << observer_.GetFingerprint();
88 } 85 }
89 else 86 else
90 { 87 {
91 (observer_.*function_) (message); 88 (observer_.*function_) (message);
92 } 89 }
93 #endif
94 } 90 }
95 91
96 virtual void Apply(const IMessage& message) 92 virtual void Apply(const IMessage& message)
97 { 93 {
98 ApplyInternal(dynamic_cast<const TMessage&>(message)); 94 ApplyInternal(dynamic_cast<const TMessage&>(message));