Changed AddObserver() to check if the observer is already in the list.

This worksaround a problem with the pres shell being added twice
This commit is contained in:
troy 1998-06-20 00:45:05 +00:00
parent 2d70af64ed
commit a89d59bb51
2 changed files with 8 additions and 2 deletions

View File

@ -338,7 +338,10 @@ void nsDocument::AddStyleSheet(nsIStyleSheet* aSheet)
// that it has a live reference to the document.
void nsDocument::AddObserver(nsIDocumentObserver* aObserver)
{
mObservers.AppendElement(aObserver);
// XXX Make sure the observer isn't already in the list
if (mObservers.IndexOf(aObserver) == -1) {
mObservers.AppendElement(aObserver);
}
}
PRBool nsDocument::RemoveObserver(nsIDocumentObserver* aObserver)

View File

@ -338,7 +338,10 @@ void nsDocument::AddStyleSheet(nsIStyleSheet* aSheet)
// that it has a live reference to the document.
void nsDocument::AddObserver(nsIDocumentObserver* aObserver)
{
mObservers.AppendElement(aObserver);
// XXX Make sure the observer isn't already in the list
if (mObservers.IndexOf(aObserver) == -1) {
mObservers.AppendElement(aObserver);
}
}
PRBool nsDocument::RemoveObserver(nsIDocumentObserver* aObserver)