From e325b7754644a779eea592ae606eaaa2684225f6 Mon Sep 17 00:00:00 2001 From: "waterson%netscape.com" Date: Thu, 29 Apr 1999 04:21:12 +0000 Subject: [PATCH] Bug 5637. Don't release each observer in the destructor, because we only hold a weak ref to it. r=putterman,a=chofmann. --- mailnews/base/src/nsMessageViewDataSource.cpp | 10 +++------- mailnews/base/src/nsMsgFolderDataSource.cpp | 10 +++------- mailnews/base/src/nsMsgMessageDataSource.cpp | 10 +++------- 3 files changed, 9 insertions(+), 21 deletions(-) diff --git a/mailnews/base/src/nsMessageViewDataSource.cpp b/mailnews/base/src/nsMessageViewDataSource.cpp index a0c7204414e..9b3cc323ea5 100644 --- a/mailnews/base/src/nsMessageViewDataSource.cpp +++ b/mailnews/base/src/nsMessageViewDataSource.cpp @@ -93,13 +93,9 @@ nsMessageViewDataSource::~nsMessageViewDataSource (void) RemoveDataSource(mDataSource); if(mURI) PL_strfree(mURI); - if (mObservers) { - for (PRInt32 i = mObservers->Count() - 1; i >= 0; --i) { - nsIRDFObserver* obs = (nsIRDFObserver*) mObservers->ElementAt(i); - NS_RELEASE(obs); - } - delete mObservers; - } + + delete mObservers; // we only hold a weak ref to each observer + nsrefcnt refcnt; NS_RELEASE2(kNC_MessageChild, refcnt); NS_RELEASE2(kNC_Subject, refcnt); diff --git a/mailnews/base/src/nsMsgFolderDataSource.cpp b/mailnews/base/src/nsMsgFolderDataSource.cpp index 8ac566b74e7..4907fc92000 100644 --- a/mailnews/base/src/nsMsgFolderDataSource.cpp +++ b/mailnews/base/src/nsMsgFolderDataSource.cpp @@ -76,13 +76,9 @@ nsMsgFolderDataSource::~nsMsgFolderDataSource (void) mRDFService->UnregisterDataSource(this); PL_strfree(mURI); - if (mObservers) { - for (PRInt32 i = mObservers->Count() - 1; i >= 0; --i) { - nsIRDFObserver* obs = (nsIRDFObserver*) mObservers->ElementAt(i); - NS_RELEASE(obs); - } - delete mObservers; - } + + delete mObservers; // we only hold a weak ref to each observer + nsrefcnt refcnt; NS_RELEASE2(kNC_Child, refcnt); NS_RELEASE2(kNC_MessageChild, refcnt); diff --git a/mailnews/base/src/nsMsgMessageDataSource.cpp b/mailnews/base/src/nsMsgMessageDataSource.cpp index 4b8e31d64dd..5cc876bdc76 100644 --- a/mailnews/base/src/nsMsgMessageDataSource.cpp +++ b/mailnews/base/src/nsMsgMessageDataSource.cpp @@ -72,13 +72,9 @@ nsMsgMessageDataSource::~nsMsgMessageDataSource (void) mRDFService->UnregisterDataSource(this); PL_strfree(mURI); - if (mObservers) { - for (PRInt32 i = mObservers->Count() - 1; i >= 0; --i) { - nsIRDFObserver* obs = (nsIRDFObserver*) mObservers->ElementAt(i); - NS_RELEASE(obs); - } - delete mObservers; - } + + delete mObservers; // we only hold a weak ref to each observer + nsrefcnt refcnt; NS_RELEASE2(kNC_Subject, refcnt);