Wrong type promotion for SharedPtr
|Reported by:||peres||Owned by:||lordhoto|
When a SharedPtr<X> is used as the contained type of a Common::List, the remove() method on the latter won't behave as expected.
Instead of invoking SharedPtr::operator==() as defined in common/ptr.h, the comparison at line 206 in common/list.h just promotes both operands to bool, and then compares them. This in turns happen to be true except when only one of the pointers is not initialized, yielding funny results that are easy to imagine.
The attached patch changes the definition of SharedPtr::operator==() to be a member of SharedPtr to fix the problem above.
I hope I got the patch in the right format.
Ticket imported from: #2641592. Ticket imported from: patches/1071.