Justin wrote:
myXpcomObj::SomeFunc()
{
   B *b = new B;
   FuncThatTakesB(b);
   delete b;
}

that's not such a good idea, if FuncThatTakesB is an xpcom function, since it may addref and release the object, and then you're deleting it twice.



But of course for objects you need not use nsMemory; only for stuff like |out string| |inout string| |out wstring| |[array,size_is(foo)] out some_type bar| etc.


Keep in mind that xpcom objects are never deleted manually (well, except in your example, but you should not normally do that... the function you are calling may also want to keep a reference, and if you are deleting the object, that would be bad)

myXpcomObj::OtherFunc()
{
 m_memberVar = FactoryFromOtherLib();
}

To answer this part of the question, the type of m_memberVar would be of interest...


If it's an object, that's ok.

Of course, if you are never calling another module, then you can do whatever you want.

The only time I have ever used nsMemory is to move raw char* around (I know thats bad).

Yeah. That's ok. _______________________________________________ Mozilla-xpcom mailing list [EMAIL PROTECTED] http://mail.mozilla.org/listinfo/mozilla-xpcom

Reply via email to