diff --git a/Foundation/include/Poco/Delegate.h b/Foundation/include/Poco/Delegate.h index 8716256af..b0b2c7615 100644 --- a/Foundation/include/Poco/Delegate.h +++ b/Foundation/include/Poco/Delegate.h @@ -28,14 +28,14 @@ namespace Poco { -template +template class Delegate: public AbstractDelegate { public: typedef void (TObj::*NotifyMethod)(const void*, TArgs&); Delegate(TObj* obj, NotifyMethod method): - _receiverObject(obj), + _receiverObject(obj), _receiverMethod(method) { } @@ -50,7 +50,7 @@ public: ~Delegate() { } - + Delegate& operator = (const Delegate& delegate) { if (&delegate != this) @@ -74,7 +74,7 @@ public: bool equals(const AbstractDelegate& other) const { - const Delegate* pOtherDelegate = reinterpret_cast(other.unwrap()); + const Delegate* pOtherDelegate = dynamic_cast(other.unwrap()); return pOtherDelegate && _receiverObject == pOtherDelegate->_receiverObject && _receiverMethod == pOtherDelegate->_receiverMethod; } @@ -82,7 +82,7 @@ public: { return new Delegate(*this); } - + void disable() { Mutex::ScopedLock lock(_mutex); @@ -99,14 +99,14 @@ private: }; -template +template class Delegate: public AbstractDelegate { public: typedef void (TObj::*NotifyMethod)(TArgs&); Delegate(TObj* obj, NotifyMethod method): - _receiverObject(obj), + _receiverObject(obj), _receiverMethod(method) { } @@ -121,7 +121,7 @@ public: ~Delegate() { } - + Delegate& operator = (const Delegate& delegate) { if (&delegate != this) @@ -145,7 +145,7 @@ public: bool equals(const AbstractDelegate& other) const { - const Delegate* pOtherDelegate = reinterpret_cast(other.unwrap()); + const Delegate* pOtherDelegate = dynamic_cast(other.unwrap()); return pOtherDelegate && _receiverObject == pOtherDelegate->_receiverObject && _receiverMethod == pOtherDelegate->_receiverMethod; } @@ -153,7 +153,7 @@ public: { return new Delegate(*this); } - + void disable() { Mutex::ScopedLock lock(_mutex); @@ -240,14 +240,14 @@ inline FunctionDelegate delegate(void (*NotifyMethod)(TArgs&)) } -template +template class Delegate: public AbstractDelegate { public: typedef void (TObj::*NotifyMethod)(const void*); Delegate(TObj* obj, NotifyMethod method): - _receiverObject(obj), + _receiverObject(obj), _receiverMethod(method) { } @@ -262,7 +262,7 @@ public: ~Delegate() { } - + Delegate& operator = (const Delegate& delegate) { if (&delegate != this) @@ -286,7 +286,7 @@ public: bool equals(const AbstractDelegate& other) const { - const Delegate* pOtherDelegate = reinterpret_cast(other.unwrap()); + const Delegate* pOtherDelegate = dynamic_cast(other.unwrap()); return pOtherDelegate && _receiverObject == pOtherDelegate->_receiverObject && _receiverMethod == pOtherDelegate->_receiverMethod; } @@ -294,7 +294,7 @@ public: { return new Delegate(*this); } - + void disable() { Mutex::ScopedLock lock(_mutex); @@ -311,14 +311,14 @@ private: }; -template +template class Delegate: public AbstractDelegate { public: typedef void (TObj::*NotifyMethod)(); Delegate(TObj* obj, NotifyMethod method): - _receiverObject(obj), + _receiverObject(obj), _receiverMethod(method) { } @@ -333,7 +333,7 @@ public: ~Delegate() { } - + Delegate& operator = (const Delegate& delegate) { if (&delegate != this) @@ -357,7 +357,7 @@ public: bool equals(const AbstractDelegate& other) const { - const Delegate* pOtherDelegate = reinterpret_cast(other.unwrap()); + const Delegate* pOtherDelegate = dynamic_cast(other.unwrap()); return pOtherDelegate && _receiverObject == pOtherDelegate->_receiverObject && _receiverMethod == pOtherDelegate->_receiverMethod; } @@ -365,7 +365,7 @@ public: { return new Delegate(*this); } - + void disable() { Mutex::ScopedLock lock(_mutex);