RESOLVED FIXED 6191
RefPtr/PassRefPtr have a leak issue, operator== issues
https://bugs.webkit.org/show_bug.cgi?id=6191
Summary RefPtr/PassRefPtr have a leak issue, operator== issues
Darin Adler
Reported 2005-12-21 21:56:06 PST
I have a patch that fixes these things: 1) adds a constructor that lets you mix PassRefPtr objects of compatible types 2) optimizes PassRefPtr::adopt so it doesn't first set m_ptr to 0 3) allows assignment of PassRefPtr objects from a RefPtr of any compatible type and vice versa 4) fixes a leak in the type conversion operator that converts a PassRefPtr to one of another compatible type 5) allows mixing compatible types in == and != for PassRefPtr and RefPtr 6) removes extraneous const in == and != operator implementations (which was probably harmless)
Attachments
patch that fixes the issues described in the bug (14.18 KB, patch)
2005-12-21 22:02 PST, Darin Adler
mjs: review+
Darin Adler
Comment 1 2005-12-21 22:00:46 PST
Marking P1 because of the potential leak.
Darin Adler
Comment 2 2005-12-21 22:02:02 PST
Created attachment 5212 [details] patch that fixes the issues described in the bug
Darin Adler
Comment 3 2005-12-21 22:33:59 PST
*** Bug 6165 has been marked as a duplicate of this bug. ***
Maciej Stachowiak
Comment 4 2005-12-22 02:34:16 PST
Why this part: "Remove non-template constructor that takes RefPtr [from PassRefPtr]." Other than that, all changes look great to me.
Maciej Stachowiak
Comment 5 2005-12-22 02:57:49 PST
r=me assuming you add a good explanation of why the PassRefPtr constructor that takes RefPtr was removed.
Darin Adler
Comment 6 2005-12-22 07:31:40 PST
Here's the rationale: There's still a template constructor that takes a RefPtr in PassRefPtr that should cover any RefPtr. I believe there's no need for a non-template constructor specifically for a RefPtr to the same class as the PassRefPtr.
Darin Adler
Comment 7 2005-12-22 07:34:41 PST
I'm not entirely clear in what situations it's helpful to have both a constructor and constructor template that overlap. I believe in the case of constructing a PassRefPtr from a RefPtr that the constructor template suffices by itself and we don't also need the non-template constructor.
Note You need to log in before you can comment on or make changes to this bug.