95584 r=bienvenu sr=mscott. Made it so that compacting folders and downnloading messages do not

overwrite each others data.
This commit is contained in:
naving%netscape.com 2001-09-20 03:07:59 +00:00
Родитель e127251f32
Коммит b69f52f2ef
2 изменённых файлов: 18 добавлений и 8 удалений

Просмотреть файл

@ -292,11 +292,19 @@ NS_IMETHODIMP nsFolderCompactState::StartCompacting()
{
nsresult rv = NS_OK;
PRBool isLocked;
nsCOMPtr <nsISupports> supports = do_QueryInterface(NS_STATIC_CAST(nsIMsgFolderCompactor*, this));
m_folder->GetLocked(&isLocked);
if(!isLocked)
m_folder->AcquireSemaphore(m_folder);
m_folder->AcquireSemaphore(supports);
else
FinishCompact();
{
NS_ASSERTION(0, "Some other operation is in progress on this folder");
m_folder->NotifyCompactCompleted();
if (m_compactAll)
CompactNextFolder();
else
return rv;
}
if (m_size > 0)
{
ShowCompactingStatusMsg();
@ -397,9 +405,10 @@ nsFolderCompactState::ReleaseFolderLock()
nsresult result = NS_OK;
if (!m_folder) return result;
PRBool haveSemaphore;
result = m_folder->TestSemaphore(m_folder, &haveSemaphore);
nsCOMPtr <nsISupports> supports = do_QueryInterface(NS_STATIC_CAST(nsIMsgFolderCompactor*, this));
result = m_folder->TestSemaphore(supports, &haveSemaphore);
if(NS_SUCCEEDED(result) && haveSemaphore)
result = m_folder->ReleaseSemaphore(m_folder);
result = m_folder->ReleaseSemaphore(supports);
return result;
}

Просмотреть файл

@ -142,10 +142,10 @@ nsPop3Sink::BeginMailDelivery(PRBool uidlDownload, PRBool* aBool)
// ### if we're doing a UIDL, then the fileSpec needs to be for the current folder
PRBool isLocked;
nsCOMPtr <nsISupports> supports = do_QueryInterface(NS_STATIC_CAST(nsIPop3Sink*, this));
m_folder->GetLocked(&isLocked);
if(!isLocked)
m_folder->AcquireSemaphore(m_folder);
m_folder->AcquireSemaphore(supports);
else
return NS_MSG_FOLDER_BUSY;
@ -238,9 +238,10 @@ nsPop3Sink::ReleaseFolderLock()
nsresult result = NS_OK;
if (!m_folder) return result;
PRBool haveSemaphore;
result = m_folder->TestSemaphore(m_folder, &haveSemaphore);
nsCOMPtr <nsISupports> supports = do_QueryInterface(NS_STATIC_CAST(nsIPop3Sink*, this));
result = m_folder->TestSemaphore(supports, &haveSemaphore);
if(NS_SUCCEEDED(result) && haveSemaphore)
result = m_folder->ReleaseSemaphore(m_folder);
result = m_folder->ReleaseSemaphore(supports);
return result;
}