On Thu, Aug 17, 2017 at 7:07 AM, Enrico Weigelt, metux IT consult
<enrico.weig...@gr13.net> wrote:
> OTOH, is there a way to create versions that really return it as rval,
> so I conveniently could just call like that ?
>
>    nsCOMPtr<nsIMutableArray> list = addrbook->FindRecipients(addr);

You can do this with a return type of
already_AddRefed<nsIMutableArray>.  Then instead of

  list.forget(_retval);
  return NS_OK;

you do just

  return list.forget();

Note that in this case you cannot ignore the return value -- it must
be assigned to an nsCOMPtr or a RefPtr, or else it will leak.  Ideally
we would allow a return type of nsCOMPtr<nsIMutableArray>&&, but
currently I think we don't.
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to