зеркало из https://github.com/mozilla/gecko-dev.git
fixed bug 11025 -- crashes after IMAP copy operation; has to use proxy event to fix the problem
This commit is contained in:
Родитель
fee317b78f
Коммит
6e19f8e061
|
@ -23,6 +23,7 @@
|
|||
#include "nsImapCore.h"
|
||||
#include "nsIImapProtocol.h"
|
||||
#include "MailNewsTypes.h"
|
||||
#include "nsIMsgMailNewsUrl.h"
|
||||
|
||||
class nsIImapIncomingServer;
|
||||
|
||||
|
@ -84,6 +85,10 @@ public:
|
|||
nsIImapIncomingServer *incomingServer) = 0;
|
||||
NS_IMETHOD CopyNextStreamMessage(nsIImapProtocol* aProtocol,
|
||||
nsISupports* copyState) = 0;
|
||||
NS_IMETHOD SetUrlState(nsIImapProtocol* aProtocol,
|
||||
nsIMsgMailNewsUrl* aUrl,
|
||||
PRBool isRunning,
|
||||
nsresult statusCode) = 0;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -338,24 +338,6 @@ NS_IMETHODIMP nsImapMailFolder::GetSubFolders(nsIEnumerator* *result)
|
|||
// doesn't end with .sbd
|
||||
|
||||
PRInt32 newFlags = MSG_FOLDER_FLAG_MAIL;
|
||||
if (mDepth == 0)
|
||||
{
|
||||
#if 0
|
||||
// temporary until we do folder discovery correctly.
|
||||
nsAutoString name("Inbox");
|
||||
nsCOMPtr<nsIMsgFolder> child;
|
||||
|
||||
AddSubfolder(name, getter_AddRefs(child));
|
||||
if (NS_SUCCEEDED(GetDatabase()))
|
||||
{
|
||||
nsCOMPtr <nsIDBFolderInfo> dbFolderInfo ;
|
||||
mDatabase->GetDBFolderInfo(getter_AddRefs(dbFolderInfo));
|
||||
|
||||
if (dbFolderInfo)
|
||||
dbFolderInfo->SetMailboxName(name);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
if (path.IsDirectory()) {
|
||||
newFlags |= (MSG_FOLDER_FLAG_DIRECTORY | MSG_FOLDER_FLAG_ELIDED);
|
||||
SetFlag(newFlags);
|
||||
|
@ -2905,6 +2887,17 @@ nsImapMailFolder::CopyNextStreamMessage(nsIImapProtocol* aProtocol,
|
|||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsImapMailFolder::SetUrlState(nsIImapProtocol* aProtocol,
|
||||
nsIMsgMailNewsUrl* aUrl,
|
||||
PRBool isRunning,
|
||||
nsresult statusCode)
|
||||
{
|
||||
if (aUrl)
|
||||
return aUrl->SetUrlState(isRunning, statusCode);
|
||||
return statusCode;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsImapMailFolder::CreateDirectoryForFolder(nsFileSpec &path) //** dup
|
||||
{
|
||||
|
@ -3133,6 +3126,9 @@ nsImapMailFolder::CopyFileMessage(nsIFileSpec* fileSpec,
|
|||
PR_TRUE, isDraftOrTemplate,
|
||||
urlListener, nsnull,
|
||||
copySupport);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
imapService->SelectFolder(m_eventQueue, this, this, nsnull);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
|
|
@ -301,6 +301,10 @@ public:
|
|||
nsIImapIncomingServer *aInfo);
|
||||
NS_IMETHOD CopyNextStreamMessage(nsIImapProtocol* aProtocol,
|
||||
nsISupports* copyState);
|
||||
NS_IMETHOD SetUrlState(nsIImapProtocol* aProtocol,
|
||||
nsIMsgMailNewsUrl* aUrl,
|
||||
PRBool isRunning,
|
||||
nsresult statusCode);
|
||||
|
||||
NS_IMETHOD MatchName(nsString *name, PRBool *matches);
|
||||
// nsIMsgFilterHitNotification method(s)
|
||||
|
|
|
@ -889,8 +889,12 @@ void nsImapProtocol::ProcessCurrentURL()
|
|||
nsresult rv = NS_OK;
|
||||
|
||||
nsCOMPtr<nsIMsgMailNewsUrl> mailnewsurl = do_QueryInterface(m_runningUrl, &rv);
|
||||
if (NS_SUCCEEDED(rv) && mailnewsurl)
|
||||
mailnewsurl->SetUrlState(PR_FALSE, NS_OK); // we are done with this url.
|
||||
if (NS_SUCCEEDED(rv) && mailnewsurl && m_imapMiscellaneousSink)
|
||||
{
|
||||
m_imapMiscellaneousSink->SetUrlState(this, mailnewsurl, PR_FALSE,
|
||||
NS_OK); // we are done with this
|
||||
// url.
|
||||
}
|
||||
m_lastActiveTime = PR_Now(); // ** jt -- is this the best place for time stamp
|
||||
PseudoInterrupt(FALSE); // clear this, because we must be done interrupting?
|
||||
nsCOMPtr<nsISupports> copyState;
|
||||
|
@ -964,8 +968,11 @@ NS_IMETHODIMP nsImapProtocol::OnStartRequest(nsIChannel * /* aChannel */, nsISup
|
|||
PR_CEnterMonitor(this);
|
||||
nsresult rv = NS_OK;
|
||||
nsCOMPtr<nsIMsgMailNewsUrl> mailnewsurl = do_QueryInterface(m_runningUrl, &rv);
|
||||
if (NS_SUCCEEDED(rv) && mailnewsurl)
|
||||
mailnewsurl->SetUrlState(PR_TRUE, NS_OK);
|
||||
if (NS_SUCCEEDED(rv) && mailnewsurl && m_imapMiscellaneousSink)
|
||||
{
|
||||
m_imapMiscellaneousSink->SetUrlState(this, mailnewsurl, PR_TRUE,
|
||||
NS_OK);
|
||||
}
|
||||
PR_CExitMonitor(this);
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -976,8 +983,11 @@ NS_IMETHODIMP nsImapProtocol::OnStopRequest(nsIChannel * /* aChannel */, nsISupp
|
|||
PR_CEnterMonitor(this);
|
||||
nsresult rv = NS_OK;
|
||||
nsCOMPtr<nsIMsgMailNewsUrl> mailnewsurl = do_QueryInterface(m_runningUrl, &rv);
|
||||
if (NS_SUCCEEDED(rv) && mailnewsurl)
|
||||
mailnewsurl->SetUrlState(PR_FALSE, aStatus); // set change in url
|
||||
if (NS_SUCCEEDED(rv) && mailnewsurl && m_imapMiscellaneousSink)
|
||||
{
|
||||
m_imapMiscellaneousSink->SetUrlState(this, mailnewsurl, PR_FALSE,
|
||||
aStatus); // set change in url
|
||||
}
|
||||
m_channel = null_nsCOMPtr();
|
||||
m_outputStream = null_nsCOMPtr();
|
||||
m_inputStream = null_nsCOMPtr();
|
||||
|
|
|
@ -1839,6 +1839,37 @@ nsImapMiscellaneousSinkProxy::CopyNextStreamMessage(nsIImapProtocol* aProtocol,
|
|||
return res;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsImapMiscellaneousSinkProxy::SetUrlState(nsIImapProtocol* aProtocol,
|
||||
nsIMsgMailNewsUrl* aUrl,
|
||||
PRBool isRunning,
|
||||
nsresult statusCode)
|
||||
{
|
||||
nsresult res = NS_OK;
|
||||
NS_PRECONDITION (aUrl, "Oops... null url");
|
||||
if(!aUrl)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
NS_ASSERTION (m_protocol == aProtocol, "Ooh ooh, wrong protocol");
|
||||
|
||||
if (PR_GetCurrentThread() == m_thread)
|
||||
{
|
||||
SetUrlStateProxyEvent *ev =
|
||||
new SetUrlStateProxyEvent(this, aUrl, isRunning, statusCode);
|
||||
if(nsnull == ev)
|
||||
res = NS_ERROR_OUT_OF_MEMORY;
|
||||
else
|
||||
{
|
||||
ev->PostEvent(m_eventQueue);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
res = m_realImapMiscellaneousSink->SetUrlState(aProtocol, aUrl,
|
||||
isRunning, statusCode);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
nsImapMailFolderSinkProxyEvent::nsImapMailFolderSinkProxyEvent(nsImapMailFolderSinkProxy*
|
||||
aProxy)
|
||||
{
|
||||
|
@ -3657,3 +3688,27 @@ CopyNextStreamMessageProxyEvent::HandleEvent()
|
|||
return res;
|
||||
}
|
||||
|
||||
SetUrlStateProxyEvent::SetUrlStateProxyEvent(
|
||||
nsImapMiscellaneousSinkProxy* aProxy, nsIMsgMailNewsUrl* aUrl,
|
||||
PRBool isRunning, nsresult statusCode) :
|
||||
nsImapMiscellaneousSinkProxyEvent(aProxy), m_isRunning(isRunning),
|
||||
m_status(statusCode)
|
||||
{
|
||||
NS_ASSERTION (aUrl, "Oops... a null url");
|
||||
m_url = do_QueryInterface(aUrl);
|
||||
}
|
||||
|
||||
SetUrlStateProxyEvent::~SetUrlStateProxyEvent()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
SetUrlStateProxyEvent::HandleEvent()
|
||||
{
|
||||
nsresult res = m_proxy->m_realImapMiscellaneousSink->SetUrlState(
|
||||
m_proxy->m_protocol, m_url, m_isRunning, m_status);
|
||||
if (m_notifyCompletion)
|
||||
m_proxy->m_protocol->NotifyFEEventCompletion();
|
||||
return res;
|
||||
}
|
||||
|
||||
|
|
|
@ -250,6 +250,11 @@ public:
|
|||
NS_IMETHOD CopyNextStreamMessage(nsIImapProtocol* aProtocl,
|
||||
nsISupports* copyState);
|
||||
|
||||
NS_IMETHOD SetUrlState(nsIImapProtocol* aProtocol,
|
||||
nsIMsgMailNewsUrl* aUrl,
|
||||
PRBool isRunning,
|
||||
nsresult statusCode);
|
||||
|
||||
nsIImapMiscellaneousSink* m_realImapMiscellaneousSink;
|
||||
};
|
||||
|
||||
|
@ -827,4 +832,16 @@ struct CopyNextStreamMessageProxyEvent : public nsImapMiscellaneousSinkProxyEven
|
|||
nsCOMPtr<nsISupports> m_copyState;
|
||||
};
|
||||
|
||||
struct SetUrlStateProxyEvent : public nsImapMiscellaneousSinkProxyEvent
|
||||
{
|
||||
SetUrlStateProxyEvent(nsImapMiscellaneousSinkProxy* aProxy,
|
||||
nsIMsgMailNewsUrl* aUrl, PRBool isRunning,
|
||||
nsresult statusCode);
|
||||
virtual ~SetUrlStateProxyEvent();
|
||||
NS_IMETHOD HandleEvent();
|
||||
nsCOMPtr<nsIMsgMailNewsUrl> m_url;
|
||||
PRBool m_isRunning;
|
||||
nsresult m_status;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
Загрузка…
Ссылка в новой задаче