mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-23 02:47:07 +00:00
Bug 805207 - Remove static destructor from ClearOnShutdown. r=bsmedberg
This prevents the assertion added in bug 803688 from firing when we do an unclean shutdown.
This commit is contained in:
parent
8fc123df0d
commit
eabc6a4f19
@ -11,7 +11,7 @@ namespace mozilla {
|
||||
namespace ClearOnShutdown_Internal {
|
||||
|
||||
bool sHasShutDown = false;
|
||||
LinkedList<ShutdownObserver> sShutdownObservers;
|
||||
StaticAutoPtr<LinkedList<ShutdownObserver> > sShutdownObservers;
|
||||
|
||||
} // namespace ClearOnShutdown_Internal
|
||||
} // namespace mozilla
|
||||
|
@ -8,6 +8,7 @@
|
||||
#define mozilla_ClearOnShutdown_h
|
||||
|
||||
#include "mozilla/LinkedList.h"
|
||||
#include "mozilla/StaticPtr.h"
|
||||
#include "nsThreadUtils.h"
|
||||
|
||||
/*
|
||||
@ -64,7 +65,7 @@ private:
|
||||
};
|
||||
|
||||
extern bool sHasShutDown;
|
||||
extern LinkedList<ShutdownObserver> sShutdownObservers;
|
||||
extern StaticAutoPtr<LinkedList<ShutdownObserver> > sShutdownObservers;
|
||||
|
||||
} // namespace ClearOnShutdown_Internal
|
||||
|
||||
@ -74,10 +75,12 @@ inline void ClearOnShutdown(SmartPtr *aPtr)
|
||||
using namespace ClearOnShutdown_Internal;
|
||||
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
MOZ_ASSERT(!sHasShutDown);
|
||||
ShutdownObserver *observer = new PointerClearer<SmartPtr>(aPtr);
|
||||
sShutdownObservers.insertBack(observer);
|
||||
|
||||
if (!sShutdownObservers) {
|
||||
sShutdownObservers = new LinkedList<ShutdownObserver>();
|
||||
}
|
||||
sShutdownObservers->insertBack(new PointerClearer<SmartPtr>(aPtr));
|
||||
}
|
||||
|
||||
// Called when XPCOM is shutting down, after all shutdown notifications have
|
||||
@ -89,11 +92,12 @@ inline void KillClearOnShutdown()
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
ShutdownObserver *observer;
|
||||
while ((observer = sShutdownObservers.popFirst())) {
|
||||
while ((observer = sShutdownObservers->popFirst())) {
|
||||
observer->Shutdown();
|
||||
delete observer;
|
||||
}
|
||||
|
||||
sShutdownObservers = nullptr;
|
||||
sHasShutDown = true;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user