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.
Created attachment 5172 [details] fix the problems
Created attachment 5177 [details] fix problem with last attachment First version had a bug and caused more leaks. This version is better.
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
OK, fixed it to take a const&