fixed GH #2106: Undefined behavior in Delegate::equals()

This commit is contained in:
Günter Obiltschnig 2018-03-06 18:26:49 +01:00
parent d73bb2ea86
commit 0d3c3ce4d4

View File

@ -74,7 +74,7 @@ public:
bool equals(const AbstractDelegate<TArgs>& other) const
{
const Delegate* pOtherDelegate = reinterpret_cast<const Delegate*>(other.unwrap());
const Delegate* pOtherDelegate = dynamic_cast<const Delegate*>(other.unwrap());
return pOtherDelegate && _receiverObject == pOtherDelegate->_receiverObject && _receiverMethod == pOtherDelegate->_receiverMethod;
}
@ -145,7 +145,7 @@ public:
bool equals(const AbstractDelegate<TArgs>& other) const
{
const Delegate* pOtherDelegate = reinterpret_cast<const Delegate*>(other.unwrap());
const Delegate* pOtherDelegate = dynamic_cast<const Delegate*>(other.unwrap());
return pOtherDelegate && _receiverObject == pOtherDelegate->_receiverObject && _receiverMethod == pOtherDelegate->_receiverMethod;
}
@ -286,7 +286,7 @@ public:
bool equals(const AbstractDelegate<void>& other) const
{
const Delegate* pOtherDelegate = reinterpret_cast<const Delegate*>(other.unwrap());
const Delegate* pOtherDelegate = dynamic_cast<const Delegate*>(other.unwrap());
return pOtherDelegate && _receiverObject == pOtherDelegate->_receiverObject && _receiverMethod == pOtherDelegate->_receiverMethod;
}
@ -357,7 +357,7 @@ public:
bool equals(const AbstractDelegate<void>& other) const
{
const Delegate* pOtherDelegate = reinterpret_cast<const Delegate*>(other.unwrap());
const Delegate* pOtherDelegate = dynamic_cast<const Delegate*>(other.unwrap());
return pOtherDelegate && _receiverObject == pOtherDelegate->_receiverObject && _receiverMethod == pOtherDelegate->_receiverMethod;
}