mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-10 20:05:49 +00:00
fix crash after renaming local folder while it's being reparsed r=naving, sr=sspitzer 105108
This commit is contained in:
parent
5221d5331e
commit
cb48a3af3a
@ -1264,11 +1264,17 @@ NS_IMETHODIMP nsMsgLocalMailFolder::Rename(const PRUnichar *aNewName, nsIMsgWind
|
||||
NotifyStoreClosedAllHeaders();
|
||||
ForceDBClosed();
|
||||
|
||||
oldPathSpec->Rename(newNameStr.get());
|
||||
|
||||
rv = oldPathSpec->Rename(newNameStr.get());
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
newNameStr += ".msf";
|
||||
oldSummarySpec.Rename(newNameStr.get());
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
ThrowAlertMsg("folderRenameFailed", msgWindow);
|
||||
return rv;
|
||||
}
|
||||
|
||||
if (NS_SUCCEEDED(rv) && cnt > 0) {
|
||||
// rename "*.sbd" directory
|
||||
@ -1362,12 +1368,20 @@ nsMsgLocalMailFolder::GetDBFolderInfoAndDB(nsIDBFolderInfo **folderInfo, nsIMsgD
|
||||
return NS_ERROR_NULL_POINTER; //ducarroz: should we use NS_ERROR_INVALID_ARG?
|
||||
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIMsgDatabase> mailDBFactory( do_CreateInstance(kCMailDB, &rv) );
|
||||
nsCOMPtr<nsIMsgDatabase> mailDB;
|
||||
if (mDatabase)
|
||||
{
|
||||
mailDB = mDatabase;
|
||||
openErr = NS_OK;
|
||||
}
|
||||
else
|
||||
{
|
||||
nsCOMPtr<nsIMsgDatabase> mailDBFactory( do_CreateInstance(kCMailDB, &rv) );
|
||||
if (NS_SUCCEEDED(rv) && mailDBFactory)
|
||||
{
|
||||
openErr = mailDBFactory->OpenFolderDB(this, PR_FALSE, PR_FALSE, getter_AddRefs(mailDB));
|
||||
}
|
||||
}
|
||||
|
||||
*db = mailDB;
|
||||
NS_IF_ADDREF(*db);
|
||||
|
@ -246,7 +246,11 @@ NS_IMETHODIMP nsMsgMailboxParser::OnParentChanged(nsMsgKey aKeyChanged, nsMsgKey
|
||||
/* void OnAnnouncerGoingAway (in nsIDBChangeAnnouncer instigator); */
|
||||
NS_IMETHODIMP nsMsgMailboxParser::OnAnnouncerGoingAway(nsIDBChangeAnnouncer *instigator)
|
||||
{
|
||||
m_mailDB = nsnull; // what else do we need to do here?
|
||||
if (m_mailDB)
|
||||
m_mailDB->RemoveListener(this);
|
||||
|
||||
m_newMsgHdr = nsnull;
|
||||
m_mailDB = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -479,6 +483,8 @@ PRInt32 nsMsgMailboxParser::HandleLine(char *line, PRUint32 lineLength)
|
||||
// otherwise, the message parser can handle it completely.
|
||||
else if (m_mailDB != nsnull) // if no DB, do we need to parse at all?
|
||||
return ParseFolderLine(line, lineLength);
|
||||
else
|
||||
return NS_ERROR_NULL_POINTER; // need to error out if we don't have a db.
|
||||
|
||||
return 0;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user