Bug 6158

Summary: Fix leaks in PassRefPtr
Product: WebKit Reporter: Maciej Stachowiak <mjs>
Component: WebKit Misc.Assignee: Maciej Stachowiak <mjs>
Status: RESOLVED FIXED    
Severity: Normal    
Priority: P2    
Version: 420+   
Hardware: Mac   
OS: OS X 10.4   
Attachments:
Description Flags
fix the problems
none
fix problem with last attachment darin: review+

Description Maciej Stachowiak 2005-12-20 02:43:11 PST
There's two problems with PassRefPtr that can cause memory problems:

1) The RefPtr assignment from PassRefPtr has an extra ref

2) PassRefPtr doesn't declare a copy constructor, this means the default is used and that doesn't properly 
transfer ownership.
Comment 1 Maciej Stachowiak 2005-12-20 02:44:28 PST
Created attachment 5172 [details]
fix the problems
Comment 2 Maciej Stachowiak 2005-12-20 04:20:50 PST
Created attachment 5177 [details]
fix problem with last attachment

First version had a bug and caused more leaks. This version is better.
Comment 3 Darin Adler 2005-12-20 09:11:56 PST
Comment on attachment 5177 [details]
fix problem with last attachment

I think pass should take a const RefPtr<T>& rather than a RefPtr<T> to avoid
reference count churn.

r=me
Comment 4 Maciej Stachowiak 2005-12-20 12:04:16 PST
OK, fixed it to take a const&