Closed Bug 1029180 Opened 7 years ago Closed 7 years ago
Remove dangerous public destructor of ns
Noticed that nsStyleContext (which provides its own AddRef() / Release() methods) has a public destructor. We should make its destructor private, to prevent ourselves from accidentally instantiating it outside of a nsRefPtr, per https://groups.google.com/d/msg/mozilla.dev.platform/jMDAQtBzdCA/_c8tpG6TnFoJ and related bugs. (bug 984786, bug 1027251)
Attachment #8444751 - Flags: review?(cam) → review+
To make this less likely to regress accidentally, you could use MOZ_ASSERT_TYPE_OK_FOR_REFCOUNTING. It is currently only used internally in nsISupportsImpl.h but it's OK to start relying on it. We have to expose it anyway, as far as my understanding of the C preprocessor goes.
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla33
You need to log in before you can comment on or make changes to this bug.