mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-29 15:52:07 +00:00
Bug 612551 - Clear appshell observers on xpcom-shutdown. r=blassey a=blocking-fennec
This commit is contained in:
parent
5144427ff0
commit
a7bf9ca858
@ -75,6 +75,8 @@ nsIGeolocationUpdate *gLocationCallback = nsnull;
|
||||
|
||||
nsAppShell *nsAppShell::gAppShell = nsnull;
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED1(nsAppShell, nsBaseAppShell, nsIObserver)
|
||||
|
||||
nsAppShell::nsAppShell()
|
||||
: mQueueLock(nsnull),
|
||||
mCondLock(nsnull),
|
||||
@ -114,9 +116,27 @@ nsAppShell::Init()
|
||||
nsresult rv = nsBaseAppShell::Init();
|
||||
if (AndroidBridge::Bridge())
|
||||
AndroidBridge::Bridge()->NotifyAppShellReady();
|
||||
|
||||
nsCOMPtr<nsIObserverService> obsServ =
|
||||
mozilla::services::GetObserverService();
|
||||
if (obsServ) {
|
||||
obsServ->AddObserver(this, "xpcom-shutdown", PR_FALSE);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAppShell::Observe(nsISupports* aSubject,
|
||||
const char* aTopic,
|
||||
const PRUnichar* aData)
|
||||
{
|
||||
if (!strcmp(aTopic, "xpcom-shutdown")) {
|
||||
// We need to ensure no observers stick around after XPCOM shuts down
|
||||
// or we'll see crashes, as the app shell outlives XPConnect.
|
||||
mObserversHash.Clear();
|
||||
}
|
||||
return nsBaseAppShell::Observe(aSubject, aTopic, aData);
|
||||
}
|
||||
|
||||
void
|
||||
nsAppShell::ScheduleNativeEventCallback()
|
||||
|
@ -61,6 +61,9 @@ public:
|
||||
|
||||
nsAppShell();
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_NSIOBSERVER
|
||||
|
||||
nsresult Init();
|
||||
|
||||
void NotifyNativeEvent();
|
||||
|
Loading…
Reference in New Issue
Block a user