fix for #134743. Turbo on, mailing list entries duplicated after an exit/restart.

r=racham, sr=bienvenu.
This commit is contained in:
sspitzer%netscape.com 2002-04-18 22:01:00 +00:00
Родитель 61db254169
Коммит eefb8c38c3
3 изменённых файлов: 28 добавлений и 8 удалений

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

@ -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);
}
}