Closed Bug 60697 Opened 24 years ago Closed 5 months ago

[meta] |static nsCOMPtr| considered harmful

Categories

(Developer Infrastructure :: Source Code Analysis, defect, P3)

Tracking

(Not tracked)

RESOLVED INACTIVE

People

(Reporter: dbaron, Unassigned)

References

()

Details

(Keywords: meta, topembed-)

I think the string "static nsCOMPtr" should not occur in the Mozilla source code. It can mean one of two things: * a static nsCOMPtr object, which implies a static ctor/dtor, which is against the rules in http://www.mozilla.org/hacking/portable-cpp.html#dont_use_static_constructors and also probably causes problems with DLL unloading (if we ever turn that back on) * a function that returns an nsCOMPtr, which is evil, because if someone assigns the result into a non-nsCOMPtr, they'll have a pointer to freed memory. already_addrefed<T> is preferred. So, does anybody see any reason to keep any of the uses listed in: http://www.mozilla.org/hacking/portable-cpp.html#dont_use_static_constructors ? There really aren't as many as I expected...
Blocks: 59530
No longer blocks: 59530
Blocks: 59530
I just posted a fix for one of these instances, to bug 59530.
I need to double-check the fix that went in for bug 60729 and continue the work there...
Dbaron, any action on this?
Not really. But hopefully I'll get to it sometime soon. Setting TM optimistically, although if someone else wants to do it that's fine with me.
Target Milestone: --- → mozilla0.9
Reality check. Moving out to 0.9.1.
Target Milestone: mozilla0.9 → mozilla0.9.1
Target Milestone: mozilla0.9.1 → mozilla0.9.2
Status: NEW → ASSIGNED
Target Milestone: mozilla0.9.2 → Future
Keywords: topembed+
per discussion w/ dougt, topembed minusing this bug.
Keywords: topembed+topembed-
Searching lxr with link in comment 1 returns no matching files.
But http://lxr.mozilla.org/seamonkey/search?string=static+nsCOMPtr does. LXR regexp searching is probably even more broken than usual.
Flags: blocking-aviary1.1?
dbaron, should this be on our radar for 1.8? If not, can you minus the blocking-aviary1.1 flag? Thanks.
Flags: blocking-aviary1.1? → blocking1.8b4?
Flags: blocking1.8b4? → blocking1.8b4-
QA Contact: kandrot → nobody
QA Contact: nobody → xpcom
No longer depends on: 224602
Keywords: meta
Assignee: dbaron → nobody
Component: XPCOM → Rewriting and Analysis
Priority: P4 → --
QA Contact: xpcom → rewriting-and-analysis
Target Milestone: Future → ---
This is a mass change. Every comment has "assigned-to-new" in it. I didn't look through the bugs, so I'm sorry if I change a bug which shouldn't be changed. But I guess these bugs are just bugs that were once assigned and people forgot to change the Status back when unassigning.
Status: ASSIGNED → NEW
Flags: wanted1.9.2?
Product: Core → Firefox Build System
David, 18 years after, does it still make sense? We have still a few occurrences: https://searchfox.org/mozilla-central/search?q=static+nsCOMPtr&path=
- the static destructor issue still exists (although some of the problems caused by static destructors no longer do), StaticRefPtr avoids it - Returning nsCOMPtr has been improved by https://hg.mozilla.org/mozilla-central/rev/a0daadf6943ce11e9858cdcb7aacfd63dfc0ce39, though there may be other reasons already_AddRefed<T> may still be better
Priority: -- → P3
Summary: |static nsCOMPtr| considered harmful → [meta] |static nsCOMPtr| considered harmful
Product: Firefox Build System → Developer Infrastructure
Severity: normal → S3

closing as we haven't been using it for a while

Status: NEW → RESOLVED
Closed: 5 months ago
Resolution: --- → INACTIVE
You need to log in before you can comment on or make changes to this bug.