mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 837874: Check ObserverService before adding observers in MediaManager r=derf
This commit is contained in:
parent
81acab97c2
commit
e800014959
@ -1487,7 +1487,9 @@ Navigator::OnNavigation()
|
||||
#ifdef MOZ_MEDIA_NAVIGATOR
|
||||
// Inform MediaManager in case there are live streams or pending callbacks.
|
||||
MediaManager *manager = MediaManager::Get();
|
||||
manager->OnNavigation(win->WindowID());
|
||||
if (manager) {
|
||||
manager->OnNavigation(win->WindowID());
|
||||
}
|
||||
#endif
|
||||
if (mCameraManager) {
|
||||
mCameraManager->OnNavigation(win->WindowID());
|
||||
|
@ -360,10 +360,13 @@ public:
|
||||
|
||||
NS_ASSERTION(NS_IsMainThread(), "Only create MediaManager on main thread");
|
||||
nsCOMPtr<nsIObserverService> obs = services::GetObserverService();
|
||||
obs->AddObserver(sSingleton, "xpcom-shutdown", false);
|
||||
obs->AddObserver(sSingleton, "getUserMedia:response:allow", false);
|
||||
obs->AddObserver(sSingleton, "getUserMedia:response:deny", false);
|
||||
obs->AddObserver(sSingleton, "getUserMedia:revoke", false);
|
||||
if (obs) {
|
||||
obs->AddObserver(sSingleton, "xpcom-shutdown", false);
|
||||
obs->AddObserver(sSingleton, "getUserMedia:response:allow", false);
|
||||
obs->AddObserver(sSingleton, "getUserMedia:response:deny", false);
|
||||
obs->AddObserver(sSingleton, "getUserMedia:revoke", false);
|
||||
}
|
||||
// else MediaManager won't work properly and will leak (see bug 837874)
|
||||
}
|
||||
return sSingleton;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user