зеркало из https://github.com/mozilla/pjs.git
Bug 612551 - Clear appshell observers on xpcom-shutdown. r=blassey a=blocking-fennec
This commit is contained in:
Родитель
fcaaee396c
Коммит
d6d23c536d
|
@ -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();
|
||||
|
|
Загрузка…
Ссылка в новой задаче