(In reply to comment #37)
> >+class SVGLengthListHelper
> >+{
> >+ nsCOMPtr<nsIDOMSVGLengthList> mList;
> >+ PRUint32 mCount;
> >+public:
> >+ SVGLengthListHelper(const already_AddRefed<nsIDOMSVGLengthList> list);
>
> I don't think you can use already_AddRefed as a function argument. AFAIK that
> construct is only for return values. You want to make the argument a raw
> pointer and probably use already_AddRefed when you call it.
Yes, on further research (bug #172030), |already_AddRefed<T>| is used as a temporary _short_ lived return value.
Also (bug #178187), using the raw pointer result of already_AddRefed<T>::get() doesn't make clear the transfer of ownership.
I struggled with this for a while because I wanted the ownership to be inside the helper class. Rather than extract and pass the raw pointer it might be clearer to keep the ownership outside of the class.
(In reply to comment #37) nsIDOMSVGLength List> mList; lper(const already_ AddRefed< nsIDOMSVGLength List> list);
> >+class SVGLengthListHelper
> >+{
> >+ nsCOMPtr<
> >+ PRUint32 mCount;
> >+public:
> >+ SVGLengthListHe
>
> I don't think you can use already_AddRefed as a function argument. AFAIK that
> construct is only for return values. You want to make the argument a raw
> pointer and probably use already_AddRefed when you call it.
Yes, on further research (bug #172030), |already_ AddRefed< T>| is used as a temporary _short_ lived return value.
Also (bug #178187), using the raw pointer result of already_ AddRefed< T>::get( ) doesn't make clear the transfer of ownership.
I struggled with this for a while because I wanted the ownership to be inside the helper class. Rather than extract and pass the raw pointer it might be clearer to keep the ownership outside of the class.