зеркало из https://github.com/mozilla/pjs.git
fix for #134743. Turbo on, mailing list entries duplicated after an exit/restart.
r=racham, sr=bienvenu.
This commit is contained in:
Родитель
61db254169
Коммит
eefb8c38c3
|
@ -62,6 +62,15 @@ nsAbDirProperty::nsAbDirProperty(void)
|
|||
|
||||
nsAbDirProperty::~nsAbDirProperty(void)
|
||||
{
|
||||
if (m_AddressList) {
|
||||
PRUint32 count;
|
||||
nsresult rv;
|
||||
rv = m_AddressList->Count(&count);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "Count failed");
|
||||
PRInt32 i;
|
||||
for (i = count - 1; i >= 0; i--)
|
||||
m_AddressList->RemoveElementAt(i);
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsAbDirProperty,nsIAbDirectory)
|
||||
|
|
|
@ -56,10 +56,11 @@
|
|||
|
||||
nsAbMDBDirProperty::nsAbMDBDirProperty(void)
|
||||
{
|
||||
m_dbRowID = 0;
|
||||
}
|
||||
|
||||
nsAbMDBDirProperty::~nsAbMDBDirProperty(void)
|
||||
{
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
@ -109,7 +110,6 @@ NS_IMETHODIMP nsAbMDBDirProperty::AddMailListToDirectory(nsIAbDirectory *mailLis
|
|||
/* add addresses to the mailing list */
|
||||
NS_IMETHODIMP nsAbMDBDirProperty::AddAddressToList(nsIAbCard *card)
|
||||
{
|
||||
|
||||
if (!m_AddressList)
|
||||
NS_NewISupportsArray(getter_AddRefs(m_AddressList));
|
||||
PRUint32 i, count;
|
||||
|
|
|
@ -3041,14 +3041,25 @@ nsresult nsAddrDatabase::CreateABList(nsIMdbRow* listRow, nsIAbDirectory **resul
|
|||
|
||||
nsCOMPtr<nsIAbMDBDirectory> dbmailList (do_QueryInterface(mailList, &rv));
|
||||
|
||||
if (mailList)
|
||||
{
|
||||
GetListFromDB(mailList, listRow);
|
||||
dbmailList->SetDbRowID(rowID);
|
||||
mailList->SetIsMailList(PR_TRUE);
|
||||
if (mailList)
|
||||
{
|
||||
// if we are using turbo, and we "exit" and restart with the same profile
|
||||
// the current mailing list will still be in memory, so when we do
|
||||
// GetResource() and QI, we'll get it again.
|
||||
// in that scenario, the mailList that we pass in will already be
|
||||
// be a mailing list, with a valid row and all the entries
|
||||
// in that scenario, we can skip GetListFromDB(), which would have
|
||||
// have added all the cards to the list again.
|
||||
// see bug #134743
|
||||
mdb_id existingID;
|
||||
dbmailList->GetDbRowID(&existingID);
|
||||
if (existingID != rowID) {
|
||||
GetListFromDB(mailList, listRow);
|
||||
dbmailList->SetDbRowID(rowID);
|
||||
mailList->SetIsMailList(PR_TRUE);
|
||||
}
|
||||
|
||||
dbm_dbDirectory->AddMailListToDirectory(mailList);
|
||||
|
||||
NS_IF_ADDREF(*result = mailList);
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче