diff --git a/mozilla/mailnews/addrbook/src/nsAbDirProperty.cpp b/mozilla/mailnews/addrbook/src/nsAbDirProperty.cpp index bbdcbf4846e..3d2fa0f65d6 100644 --- a/mozilla/mailnews/addrbook/src/nsAbDirProperty.cpp +++ b/mozilla/mailnews/addrbook/src/nsAbDirProperty.cpp @@ -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) diff --git a/mozilla/mailnews/addrbook/src/nsAbMDBDirProperty.cpp b/mozilla/mailnews/addrbook/src/nsAbMDBDirProperty.cpp index 36e7a5b362a..58ca7bebd4d 100644 --- a/mozilla/mailnews/addrbook/src/nsAbMDBDirProperty.cpp +++ b/mozilla/mailnews/addrbook/src/nsAbMDBDirProperty.cpp @@ -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; diff --git a/mozilla/mailnews/addrbook/src/nsAddrDatabase.cpp b/mozilla/mailnews/addrbook/src/nsAddrDatabase.cpp index 96950fab49a..8a5365b1804 100644 --- a/mozilla/mailnews/addrbook/src/nsAddrDatabase.cpp +++ b/mozilla/mailnews/addrbook/src/nsAddrDatabase.cpp @@ -3041,14 +3041,25 @@ nsresult nsAddrDatabase::CreateABList(nsIMdbRow* listRow, nsIAbDirectory **resul nsCOMPtr 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); } }