That accounting is useful on debug builds. Arguably, debug builds don't
have to care about avoiding static initializers. So we could add a
destructor to Static*Ptrs on debug builds that:
- sends a error that ClearOnShutdown was not called on them
or
- clears them to clear the leak
or
- both (replacing the error with a warning)
Mike
Yeah, we could do that. But turning on leak checking does the same
thing as (a) so (b) is the only useful code change to make.
Not only that, but it also makes our code correct. There is nothing
to guarantee that one of those destrcutors we're skipping right now
would not have observable side effects passed shutdown. So until
somone comes up with an idea on how to enforce that, we should clear
these on all builds. Please make it so. :-)
I don't understand this sentence, but I strongly oppose automatically
clearing Static*Ptr in the static destructor in any build. In the past
we have had static comptr cause final release of objects after XPCOM
shutdown, which causes crashes due to the component manager or CC or
other infrastructure already being shut down.
The leak is an intentional safety feature of these classes so that if we
do leak, we don't accidentally cause some other more serious problem to
occur well past shutdown.
I support the debug assertion: it's better than our automated leak
checking because it will affect people who run normal debug builds and
not just automation.
--BDS
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform