зеркало из https://github.com/mozilla/gecko-dev.git
Bug 594222 - Prevent RemoveObservers from being called more than once. r=dougt a=dougt
This commit is contained in:
Родитель
ce401c553a
Коммит
fe636eb3c3
|
@ -44,7 +44,7 @@
|
|||
|
||||
nsCategoryObserver::nsCategoryObserver(const char* aCategory,
|
||||
nsCategoryListener* aListener)
|
||||
: mListener(nsnull), mCategory(aCategory)
|
||||
: mListener(nsnull), mCategory(aCategory), mObserversRemoved(false)
|
||||
{
|
||||
if (!mHash.Init()) {
|
||||
// OOM
|
||||
|
@ -113,6 +113,10 @@ nsCategoryObserver::ListenerDied() {
|
|||
|
||||
NS_HIDDEN_(void)
|
||||
nsCategoryObserver::RemoveObservers() {
|
||||
if (mObserversRemoved)
|
||||
return;
|
||||
|
||||
mObserversRemoved = true;
|
||||
nsCOMPtr<nsIObserverService> obsSvc =
|
||||
do_GetService(NS_OBSERVERSERVICE_CONTRACTID);
|
||||
if (obsSvc) {
|
||||
|
|
|
@ -78,6 +78,7 @@ class NS_COM_GLUE nsCategoryObserver : public nsIObserver {
|
|||
nsDataHashtable<nsCStringHashKey, nsCString> mHash;
|
||||
nsCategoryListener* mListener;
|
||||
nsCString mCategory;
|
||||
bool mObserversRemoved;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
Загрузка…
Ссылка в новой задаче