Closed
Bug 60697
Opened 24 years ago
Closed 5 months ago
[meta] |static nsCOMPtr| considered harmful
Categories
(Developer Infrastructure :: Source Code Analysis, defect, P3)
Developer Infrastructure
Source Code Analysis
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...
Reporter | ||
Comment 1•24 years ago
|
||
The second URL in the comment above should have been
http://lxr.mozilla.org/seamonkey/search?string=static+*nsCOMPtr®exp=on
Reporter | ||
Updated•24 years ago
|
Reporter | ||
Comment 3•24 years ago
|
||
I need to double-check the fix that went in for bug 60729 and continue the work
there...
Reporter | ||
Comment 5•24 years ago
|
||
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
Reporter | ||
Comment 6•24 years ago
|
||
Reality check. Moving out to 0.9.1.
Target Milestone: mozilla0.9 → mozilla0.9.1
Reporter | ||
Updated•24 years ago
|
Target Milestone: mozilla0.9.1 → mozilla0.9.2
Reporter | ||
Updated•24 years ago
|
Status: NEW → ASSIGNED
Reporter | ||
Updated•24 years ago
|
Target Milestone: mozilla0.9.2 → Future
Reporter | ||
Updated•23 years ago
|
Priority: P3 → P4
Comment 7•22 years ago
|
||
per discussion w/ dougt, topembed minusing this bug.
Reporter | ||
Comment 9•21 years ago
|
||
But http://lxr.mozilla.org/seamonkey/search?string=static+nsCOMPtr does. LXR
regexp searching is probably even more broken than usual.
Comment 10•20 years ago
|
||
dbaron, should this be on our radar for 1.8? If not, can you minus the
blocking-aviary1.1 flag? Thanks.
Updated•20 years ago
|
Flags: blocking-aviary1.1? → blocking1.8b4?
Updated•20 years ago
|
Flags: blocking1.8b4? → blocking1.8b4-
Updated•19 years ago
|
QA Contact: kandrot → nobody
Updated•19 years ago
|
QA Contact: nobody → xpcom
Updated•16 years ago
|
Updated•15 years ago
|
Assignee: dbaron → nobody
Component: XPCOM → Rewriting and Analysis
Priority: P4 → --
QA Contact: xpcom → rewriting-and-analysis
Target Milestone: Future → ---
Comment 11•15 years ago
|
||
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
Updated•13 years ago
|
Flags: wanted1.9.2?
Updated•7 years ago
|
Product: Core → Firefox Build System
Comment 12•6 years ago
|
||
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=
Reporter | ||
Comment 13•6 years ago
|
||
- 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
Updated•6 years ago
|
Priority: -- → P3
Updated•6 years ago
|
Summary: |static nsCOMPtr| considered harmful → [meta] |static nsCOMPtr| considered harmful
Updated•2 years ago
|
Product: Firefox Build System → Developer Infrastructure
Updated•2 years ago
|
Severity: normal → S3
Comment 14•5 months ago
|
||
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.
Description
•