Closed
Bug 186728
Opened 22 years ago
Closed 15 years ago
smtp service NewURI should use callqueryinterface
Categories
(MailNews Core :: Networking: SMTP, enhancement)
MailNews Core
Networking: SMTP
Tracking
(Not tracked)
RESOLVED
FIXED
Thunderbird 3.0b3
People
(Reporter: timeless, Assigned: standard8)
References
()
Details
Attachments
(1 file, 3 obsolete files)
3.73 KB,
patch
|
standard8
:
review+
standard8
:
superreview+
|
Details | Diff | Splinter Review |
from reading the netwerk impls, it looks like this could use CallQueryInterface.
Attachment #110934 -
Attachment is obsolete: true
Attachment #111141 -
Flags: superreview?(darin)
Attachment #111141 -
Flags: review?(dmose)
Comment 3•22 years ago
|
||
Comment on attachment 111141 [details] [diff] [review] and do_CreateInstance and do_QueryElementAt ... >Index: mozilla/mailnews/compose/src/nsSmtpService.cpp >=================================================================== >RCS file: /cvsroot/mozilla/mozilla/mailnews/compose/src/nsSmtpService.cpp,v >retrieving revision 1.117 >diff -u -r1.117 mozilla/mailnews/compose/src/nsSmtpService.cpp >--- mozilla/mailnews/compose/src/nsSmtpService.cpp >+++ mozilla/mailnews/compose/src/nsSmtpService.cpp >@@ -294,7 +294,7 @@ > if (aStatusFeedback) > url->SetStatusFeedback(aStatusFeedback); > } >- rv = smtpUrl->QueryInterface(NS_GET_IID(nsIURI), (void **) aUrl); >+ rv = CallQueryInterface(smtpUrl, aUrl); > } > > return rv; >@@ -321,7 +321,7 @@ > > NS_ADDREF(smtpProtocol); > rv = smtpProtocol->LoadUrl(aUrl, aConsumer); // protocol will get destroyed when url is completed... >- smtpProtocol->QueryInterface(NS_GET_IID(nsIRequest), (void **) aRequest); >+ CallQueryInterface(smtpProtocol, aRequest); > NS_RELEASE(smtpProtocol); > } > >@@ -584,12 +584,10 @@ > // get a new smtp url > > nsresult rv = NS_OK; >- nsCOMPtr <nsIURI> mailtoUrl; >+ nsCOMPtr <nsIURI> mailtoUrl = do_CreateInstance(kCMailtoUrlCID); > >- rv = nsComponentManager::CreateInstance(kCMailtoUrlCID, NULL, NS_GET_IID(nsIURI), getter_AddRefs(mailtoUrl)); >- >- if (NS_SUCCEEDED(rv)) >- { >+ if (NS_SUCCEEDED(rv)) >+ { rv will always be NS_OK here, because do_CreateInstance was only called with one param. How about calling do_CreateInstance with two params, and, while you're at it, switch from CID to ContractID. Everything else looks good, however. Note that you still need to a have mailnews module owner review this, so I'd suggest pinging sspitzer for super-review instead of darin.
Attachment #111141 -
Flags: review?(dmose) → review-
Updated•22 years ago
|
OS: Windows 2000 → All
Hardware: PC → All
Updated•21 years ago
|
Attachment #111141 -
Flags: superreview?(darin)
Updated•20 years ago
|
Product: MailNews → Core
Updated•16 years ago
|
Product: Core → MailNews Core
Comment 4•16 years ago
|
||
timeless, is this still needed? (resetting QA)
QA Contact: nbaca → networking.smtp
Comment 5•16 years ago
|
||
Yes, though I think between them darin and Standard8 have gotten everything except the smtpProtocol hunk over the years.
Assignee: timeless → nobody
Assignee | ||
Comment 6•15 years ago
|
||
Phil wasn't quite right, there were two instances left. Let's just fix them and close out this bug.
Assignee: nobody → bugzilla
Attachment #111141 -
Attachment is obsolete: true
Status: NEW → ASSIGNED
Attachment #367573 -
Flags: superreview?(neil)
Attachment #367573 -
Flags: review?(neil)
Updated•15 years ago
|
Attachment #367573 -
Flags: superreview?(neil)
Attachment #367573 -
Flags: superreview+
Attachment #367573 -
Flags: review?(neil)
Attachment #367573 -
Flags: review+
Comment 7•15 years ago
|
||
Comment on attachment 367573 [details] [diff] [review] Fix nsSmtpProtocol instance > nsresult NS_MsgLoadSmtpUrl(nsIURI * aUrl, nsISupports * aConsumer, nsIRequest ** aRequest) > { >- // for now, assume the url is an smtp url and load it.... >- nsCOMPtr <nsISmtpUrl> smtpUrl; >- nsSmtpProtocol *smtpProtocol = nsnull; >- nsresult rv = NS_OK; >+ if (!aUrl) >+ return NS_OK; >- if (!aUrl) >- return rv; Eww, not writing an outparam on success? I guess we never pass null ;-) >+ nsSmtpProtocol* smtpProtocol = new nsSmtpProtocol(aUrl); Use nsRefPtr<nsSmtpProtocol> to avoid manual addref/release, or use nsCOMPtr<nsIRequest> and .forget instead of CallQueryInterface: nsCOMPtr<nsIRequest> request(smtpProtocol); ... request.forget(aRequest); >+ nsresult rv = smtpProtocol->LoadUrl(aUrl, aConsumer); >+ CallQueryInterface(smtpProtocol, aRequest); We should only do this when LoadUrl succeeds, otherwise we'll leak... >+ return CallQueryInterface(mailtoUrl, _retval); mailtoUrl.forget(_retval);
Assignee | ||
Comment 8•15 years ago
|
||
(In reply to comment #7) > >+ nsSmtpProtocol* smtpProtocol = new nsSmtpProtocol(aUrl); > Use nsRefPtr<nsSmtpProtocol> to avoid manual addref/release, or use > nsCOMPtr<nsIRequest> and .forget instead of CallQueryInterface: > nsCOMPtr<nsIRequest> request(smtpProtocol); > ... > request.forget(aRequest); LoadUrl is a function on nsSmtpProtocol, so its the nsRefPtr option here.
Assignee | ||
Comment 9•15 years ago
|
||
This is the one I'm checking in.
Attachment #367573 -
Attachment is obsolete: true
Attachment #367577 -
Flags: superreview+
Attachment #367577 -
Flags: review+
Assignee | ||
Comment 10•15 years ago
|
||
Checked in: http://hg.mozilla.org/comm-central/rev/ec7a662e202c
Status: ASSIGNED → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
Target Milestone: --- → Thunderbird 3.0b3
You need to log in
before you can comment on or make changes to this bug.
Description
•