Closed
Bug 100751
Opened 23 years ago
Closed 15 years ago
foo.Adopt(ToNewXXX(bar)) defeats sharing
Categories
(Core :: XPCOM, defect, P3)
Core
XPCOM
Tracking
()
RESOLVED
INCOMPLETE
Future
People
(Reporter: dbaron, Assigned: dbaron)
References
()
Details
Attachments
(1 file)
The patterns foo.Adopt(ToNewXXX(bar)) where |ToNewXXX| is one of |ToNewUnicode(nsAString&)| or |ToNewCString(nsACString&)| (which don't do conversion) are harmful because they defeat sharing (for strings on which sharing is implemented). There aren't too many of these in the tree yet (although there are a few), but jag is planning to add a bunch more for bug 100476 (since apparently some of the assignment operations on nsXPIDL[C]String don't work completely yet, or are at least rumored not to). This pattern should be eliminated in favor of a simple assignment (operator= or Assign) that allows sharing.
Comment 1•23 years ago
|
||
nsXPIDL[C]String::Assign does crash, as do the related += operators, and so on.
Updated•23 years ago
|
Target Milestone: --- → mozilla0.9.6
Assignee | ||
Comment 2•23 years ago
|
||
Comment 4•23 years ago
|
||
dbaron's doing this as part of another bug, so giving it to him.
Assignee: jaggernaut → dbaron
QA Contact: scc → jaggernaut
Assignee | ||
Updated•23 years ago
|
Status: NEW → ASSIGNED
Assignee | ||
Updated•23 years ago
|
Priority: -- → P3
Assignee | ||
Comment 5•23 years ago
|
||
mozilla/mailnews/imap/src/nsImapProtocol.cpp also needs to be fixed
Assignee | ||
Updated•23 years ago
|
Assignee | ||
Comment 6•23 years ago
|
||
I still need to fix http://lxr.mozilla.org/seamonkey/source/mailnews/imap/src/nsImapProtocol.cpp#6549 but other than that these need to wait for our converters (and generators?) story to be fixed. A converter-based assign is better than this pattern since it could allow fused allocation of buffer handle and buffer.
Assignee | ||
Comment 7•23 years ago
|
||
Index: nsImapProtocol.cpp =================================================================== RCS file: /cvsroot/mozilla/mailnews/imap/src/nsImapProtocol.cpp,v retrieving revision 1.380 diff -u -d -r1.380 nsImapProtocol.cpp --- nsImapProtocol.cpp 4 Dec 2001 00:25:58 -0000 1.380 +++ nsImapProtocol.cpp 8 Dec 2001 01:23:19 -0000 @@ -6551,7 +6551,7 @@ // we are in the imap thread so *NEVER* try to extract the password with UI // if logon redirection has changed the password, use the cookie as the password if (m_overRideUrlConnectionInfo) - password.Adopt(ToNewCString(m_logonCookie)); + password.Assign(m_logonCookie); else rv = server->GetPassword(getter_Copies(password)); rv = server->GetRealUsername(&userName);
Comment 8•23 years ago
|
||
r=jag
Comment 9•23 years ago
|
||
sr=jst
Assignee | ||
Comment 10•23 years ago
|
||
Fix checked in 2001-12-08 14:42 PDT. That fixes all the cases that don't do conversion. We still need to fix the cases that do do conversion -- we should be allocating a contiguous buffer and handle, probably using some generator mechanism. Moving to Future.
Target Milestone: mozilla0.9.7 → Future
Comment 11•23 years ago
|
||
dbaron landed the fix on 12/08/2001 14:42
Status: ASSIGNED → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
Target Milestone: Future → mozilla0.9.7
Comment 12•23 years ago
|
||
Reopening. This was only partially fixed (see his last comment).
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Target Milestone: mozilla0.9.7 → Future
Updated•15 years ago
|
QA Contact: jag → string
Updated•15 years ago
|
Status: ASSIGNED → RESOLVED
Closed: 23 years ago → 15 years ago
Resolution: --- → INCOMPLETE
Updated•3 years ago
|
Component: String → XPCOM
You need to log in
before you can comment on or make changes to this bug.
Description
•