Closed
Bug 413578
Opened 17 years ago
Closed 13 years ago
null-arg checks in nsMsgAccountManager.cpp, nsMsgPurgeService.cpp, nsMsgIdentity.cpp, and nsImapIncomingServer.cpp
Categories
(MailNews Core :: Backend, defect)
MailNews Core
Backend
Tracking
(Not tracked)
RESOLVED
FIXED
Thunderbird 7.0
People
(Reporter: jminta, Assigned: gkw)
References
(Blocks 2 open bugs)
Details
(Keywords: crash, Whiteboard: [patchlove])
Attachments
(1 file, 1 obsolete file)
12.31 KB,
patch
|
Bienvenu
:
review+
|
Details | Diff | Splinter Review |
Turns out that I wasn't finished with nsImapIncomingServer in the last patch. This one also includes 2 compiler warning fixes in nsMsgAccount.cpp for unused variables.
nsMsgIdentity crashed in almost every function here (more mPrefBranch uninitialization) and is so simple/self-contained that I was really tempted to just stop fixing it and rewrite it in js. :-/ Nonetheless, here's the patch.
Note that my current statistics say we're about 3/4 done at this point.
Attachment #298618 -
Flags: superreview?(dmose)
Attachment #298618 -
Flags: review?(bugzilla)
Comment 1•17 years ago
|
||
Comment on attachment 298618 [details] [diff] [review]
patch v1
firstly, just for the review record:
nsMsgAccountManager::WriteToFolderCache(nsIMsgFolderCache *folderCache)
{
m_incomingServers.Enumerate(hashWriteFolderCache, folderCache);
- return folderCache->Close();
+ return folderCache ? folderCache->Close() : NS_ERROR_FAILURE;
the rest of the code seems to treat folderCache in this manner, so this appears to be ok.
Now for the main comments:
+ NS_ENSURE_ARG_POINTER(server);
PRInt32 count = m_incomingServerListeners.Count();
+ if (!mPrefBranch)
+ return NS_ERROR_NOT_INITIALIZED;
nsresult rv = mPrefBranch->GetCharPref(prefname, getter_Copies(retval));
nit: these need a blank line between what you've added and the next bit.
@@ -3215,7 +3217,10 @@ nsImapIncomingServer::GetPrefForServerAt
// Time to check if this server has the pref
// (mail.server.<serverkey>.prefSuffix) already set
- rv = mPrefBranch->GetBoolPref(prefName.get(), prefValue);
+ if (mPrefBranch)
+ rv = mPrefBranch->GetBoolPref(prefName.get(), prefValue);
+ else
+ rv = NS_ERROR_NOT_INITIALIZED;
I'd much rather we just returned at the start of the function avoiding setting everything up, than doing it late.
Additionally, I notice that nsCOMPtr<nsIPrefBranch> prefBranch can actually be moved inside the if (NS_FAILED(rv)), so please could you move that as well.
With that change you can then do:
nsresult rv = mPrefBranch->GetBoolPref(...
on the one line, hence tidying that up as well.
Attachment #298618 -
Flags: review?(bugzilla) → review-
Reporter | ||
Updated•17 years ago
|
Attachment #298618 -
Flags: superreview?(dmose)
Updated•16 years ago
|
Product: Core → MailNews Core
Updated•15 years ago
|
Summary: null arg checks in nsMsgAccountManager.cpp, nsMsgPurgeService.cpp, nsMsgIdentity.cpp, and nsImapIncomingServer.cpp → null-arg checks in nsMsgAccountManager.cpp, nsMsgPurgeService.cpp, nsMsgIdentity.cpp, and nsImapIncomingServer.cpp
Comment 2•14 years ago
|
||
this should be easy to drive in?
Blocks: 492772
Whiteboard: [patchlove][has draft patch][needs new assignee]
Assignee | ||
Comment 4•13 years ago
|
||
(In reply to comment #3)
> gary, how much of this still applies?
Mostly. A sort-of unbitrotted patch is coming up. :)
Assignee | ||
Comment 5•13 years ago
|
||
Unbitrotted patch with comments hopefully addressed, if I interpreted correctly.
Attachment #298618 -
Attachment is obsolete: true
Attachment #534697 -
Flags: review?(mbanner)
Comment 6•13 years ago
|
||
Comment on attachment 534697 [details] [diff] [review]
patch v2
Review of attachment 534697 [details] [diff] [review]:
-----------------------------------------------------------------
::: mailnews/base/src/nsMsgAccountManager.cpp
@@ +1622,5 @@
> NS_IMETHODIMP
> nsMsgAccountManager::WriteToFolderCache(nsIMsgFolderCache *folderCache)
> {
> m_incomingServers.Enumerate(hashWriteFolderCache, folderCache);
> + return folderCache ? folderCache->Close() : NS_ERROR_FAILURE;
From the looks of it, this function should just return a null arg if folderCache isn't supplied. Going through the enumerate it seems like nothing actually gets done, even though there's a bunch of sub-folder iteration.
I'd check with David to make sure though.
::: mailnews/base/src/nsMsgPurgeService.cpp
@@ -506,3 +506,3 @@
> > }
> >
> > NS_IMETHODIMP nsMsgPurgeService::OnSearchDone(nsresult status)
In this function, you're missing indenting of the lines where
Attachment #534697 -
Flags: review?(mbanner) → review?(dbienvenu)
Comment 7•13 years ago
|
||
Comment on attachment 534697 [details] [diff] [review]
patch v2
thx for unbitrotting this, Gary.
Attachment #534697 -
Flags: review?(dbienvenu) → review+
Assignee | ||
Comment 8•13 years ago
|
||
Fixed whitespace issues as well.
http://hg.mozilla.org/comm-central/rev/119c61c869a8
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Target Milestone: --- → Thunderbird 7.0
Assignee | ||
Updated•13 years ago
|
Assignee: jminta → gary
Whiteboard: [patchlove][has draft patch][needs new assignee] → [patchlove]
You need to log in
before you can comment on or make changes to this bug.
Description
•