#8966 closed patch
Wrong type promotion for SharedPtr
Reported by: | peres | Owned by: | lordhoto |
---|---|---|---|
Priority: | blocker | Component: | --Other-- |
Version: | Keywords: | ||
Cc: | Game: |
Description
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.
Attachments (1)
Change History (4)
by , 16 years ago
Attachment: | ptr-fix.patch added |
---|
comment:1 by , 16 years ago
Status: | new → closed |
---|
comment:3 by , 6 years ago
Component: | → --Other-- |
---|
Makes operator==() a member of SharedPtr.