Christian Biesinger wrote:

Justin wrote:

My understanding is exactly that. You only need to use nsMemory when the data is going to be used and potentially freed in a script.


Eh, no. You always should use nsMemory. of course a lot of mozilla code doesn't do that...

So what about:

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

or:

myXpcomObj::OtherFunc()
{
 m_memberVar = FactoryFromOtherLib();
}
myXpcomObj::OtherFunc2()
{
 LibFuncDoThing(m_memberVar);
  delete m_memberVar;
}

Aside from all the unsafe raw pointers, is this considered bad? Because I have a *ton* of code which uses factories and other misc stuff with an XPCOM wrapper to use it mozilla.

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



Justin
_______________________________________________
Mozilla-xpcom mailing list
[EMAIL PROTECTED]
http://mail.mozilla.org/listinfo/mozilla-xpcom

Reply via email to