[ scummvm-Patches-2641592 ] Wrong type promotion for SharedPtr

SourceForge.net noreply at sourceforge.net
Thu Feb 26 13:54:16 CET 2009


Patches item #2641592, was opened at 2009-02-26 13:54
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=418822&aid=2641592&group_id=37116

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Resolution: None
Priority: 9
Private: No
Submitted By: peres (peres001)
Assigned to: Johannes Schickel (lordhoto)
Summary: Wrong type promotion for SharedPtr

Initial Comment:
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.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=418822&aid=2641592&group_id=37116




More information about the Scummvm-tracker mailing list