On 02/08/15 07:17 AM, smaug wrote: >> Probably we should generally avoid using constructor directly for >> those cases. Instead, use helper functions like MakeUnique() or >> MakeAndAddRef(), which is much safer. > > MakeAndAddRef would have the same problem as MakeUnique. Doesn't really > tell what type is returned.
makeSomeRefCountedFoo(), newSomeRefCountedFoo() or SomeRefCountedFoo::make() returning an nsRefPtr<SomeRefCountedFoo>. It is a matter of having an enforced convention for naming them. > And when you're dealing with lifetime management issues, you really want > to know what kind of type you're playing with. This is also part of why I'd suggest having an construction method that will return a smart pointer - preventing the use of raw pointers. So that there is no ambiguity in what we deal with and its ownership. This is probably not something trivial in our codebase. Hub _______________________________________________ dev-platform mailing list dev-platform@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-platform