From 1beedf179becf11de0c48481a125a23df03efd04 Mon Sep 17 00:00:00 2001 From: "naving%netscape.com" Date: Thu, 17 Oct 2002 23:03:42 +0000 Subject: [PATCH] 172707 r=cavin sr=bienvenu a=asa fixing busy cursor problem when selecting dest folder on copying msgs and fixing a crash if the dest folder has invalid summary file. --- mailnews/base/util/nsMsgDBFolder.cpp | 12 ------------ mailnews/local/src/nsLocalMailFolder.cpp | 17 ++++++++++++++--- mailnews/local/src/nsLocalMailFolder.h | 1 + 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/mailnews/base/util/nsMsgDBFolder.cpp b/mailnews/base/util/nsMsgDBFolder.cpp index 2b34b1d437a..6565b5debcb 100644 --- a/mailnews/base/util/nsMsgDBFolder.cpp +++ b/mailnews/base/util/nsMsgDBFolder.cpp @@ -1182,20 +1182,8 @@ nsMsgDBFolder::OnStopRunningUrl(nsIURI *aUrl, nsresult aExitCode) { PRBool updatingFolder = PR_FALSE; if (NS_SUCCEEDED(mailUrl->GetUpdatingFolder(&updatingFolder)) && updatingFolder) - { NotifyFolderEvent(mFolderLoadedAtom); - //GGGG check for new mail here and call SetNewMessages...?? -- ONE OF THE 2 PLACES - if(mDatabase) - { - nsresult rv; - PRBool hasNewMessages; - - rv = mDatabase->HasNew(&hasNewMessages); - SetHasNewMessages(hasNewMessages); - } - } - // be sure to remove ourselves as a url listener mailUrl->UnRegisterListener(this); } diff --git a/mailnews/local/src/nsLocalMailFolder.cpp b/mailnews/local/src/nsLocalMailFolder.cpp index 27e92a366e4..babcd32b02b 100644 --- a/mailnews/local/src/nsLocalMailFolder.cpp +++ b/mailnews/local/src/nsLocalMailFolder.cpp @@ -116,7 +116,8 @@ extern void KillPopData(char* data); nsLocalMailCopyState::nsLocalMailCopyState() : m_fileStream(nsnull), m_curDstKey(0xffffffff), m_curCopyIndex(0), m_totalMsgCount(0), m_dataBufferSize(0), m_leftOver(0), - m_isMove(PR_FALSE), m_dummyEnvelopeNeeded(PR_FALSE), m_fromLineSeen(PR_FALSE), m_writeFailed(PR_FALSE) + m_isMove(PR_FALSE), m_dummyEnvelopeNeeded(PR_FALSE), m_fromLineSeen(PR_FALSE), m_writeFailed(PR_FALSE), + m_notifyFolderLoaded(PR_FALSE) { } @@ -362,7 +363,6 @@ NS_IMETHODIMP nsMsgLocalMailFolder::ParseFolder(nsIMsgWindow *aMsgWindow, nsIUrl AcquireSemaphore(supports); else { - delete parser; NS_ASSERTION(PR_FALSE, "Could not get folder lock"); return NS_MSG_FOLDER_BUSY; } @@ -605,7 +605,12 @@ nsresult nsMsgLocalMailFolder::GetDatabase(nsIMsgWindow *aMsgWindow) if(NS_FAILED(rv = ParseFolder(aMsgWindow, this))) { if (rv == NS_MSG_FOLDER_BUSY) + { + mDatabase->RemoveListener(this); //we need to null out the db so that parsing gets kicked off again. + mAddListener = PR_FALSE; + mDatabase = nsnull; ThrowAlertMsg("parsingFolderFailed", aMsgWindow); + } return rv; } else @@ -635,13 +640,16 @@ nsMsgLocalMailFolder::UpdateFolder(nsIMsgWindow *aWindow) { PRBool valid; rv = mDatabase->GetSummaryValid(&valid); - // don't notify folder loaded or try compaction if db isn't valid (we're probably reparsing it) + // don't notify folder loaded or try compaction if db isn't valid + // (we're probably reparsing or copying msgs to it) if (NS_SUCCEEDED(rv) && valid) { NotifyFolderEvent(mFolderLoadedAtom); rv = AutoCompact(aWindow); NS_ENSURE_SUCCESS(rv,rv); } + else if (mCopyState) + mCopyState->m_notifyFolderLoaded = PR_TRUE; //defer folder loaded notification } return rv; } @@ -1706,6 +1714,9 @@ nsMsgLocalMailFolder::InitCopyState(nsISupports* aSupport, nsresult nsMsgLocalMailFolder::OnCopyCompleted(nsISupports *srcSupport, PRBool moveCopySucceeded) { + if (mCopyState && mCopyState->m_notifyFolderLoaded) + NotifyFolderEvent(mFolderLoadedAtom); + delete mCopyState; mCopyState = nsnull; diff --git a/mailnews/local/src/nsLocalMailFolder.h b/mailnews/local/src/nsLocalMailFolder.h index 09e4b573541..5f1e88be178 100644 --- a/mailnews/local/src/nsLocalMailFolder.h +++ b/mailnews/local/src/nsLocalMailFolder.h @@ -91,6 +91,7 @@ struct nsLocalMailCopyState PRPackedBool m_fromLineSeen; PRPackedBool m_allowUndo; PRPackedBool m_writeFailed; + PRPackedBool m_notifyFolderLoaded; }; class nsMsgLocalMailFolder : public nsMsgDBFolder,