On Mon, Aug 04, 2014 at 11:33:55AM -0700, Kyle Huey wrote:
> On Sun, Aug 3, 2014 at 11:01 PM, Nicholas Nethercote
> <n.netherc...@gmail.com> wrote:
> > On Sun, Aug 3, 2014 at 10:18 PM, Kyle Huey <m...@kylehuey.com> wrote:
> >> Static*Ptrs are there to avoid
> >> static constructors and destructors so they can't clear themselves at
> >> shutdown.  That means that they behave quite differently than
> >> "regular" smart pointers.  Am I the only one who is bothered by this?
> >
> > To use them correctly, is it the case that you need to do one of the 
> > following?
> >
> > - null them at some point, or
> >
> > - call ClearOnShutdown() on them at some point.
> >
> > The comments in StaticPtr.h don't make this clear. And
> > ClearOnShutdown.h is a separate file, and ClearOnShutdown() isn't
> > mentioned in StaticPtr.h.
> >
> > So I think they're useful -- being able to avoid static constructors
> > is important. But the documentation on how to use them could be much
> > clearer.
> >
> > Nick
> 
> Yes, that's correct.  You have to clear them somehow before the
> process exits or we leak.

Which, besides accounting, is not really a problem, since the process is
exiting anyways. It can be a problem if desctructor code is actively
doing import stuff like persisting state.

Mike
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to