Bug 1313585 - Part 1: Removing gamepads while nsGlobalWindow is removed in GamepadManager; r?lenzak800, qdot
MozReview-Commit-ID: 8kh0hyqzOyW
--- a/dom/gamepad/GamepadManager.cpp
+++ b/dom/gamepad/GamepadManager.cpp
@@ -172,16 +172,20 @@ GamepadManager::RemoveListener(nsGlobalW
// as a result of our own destructor here, so just bail out.
return;
}
if (mListeners.IndexOf(aWindow) == NoIndex) {
return; // doesn't exist
}
+ for (auto iter = mGamepads.Iter(); !iter.Done(); iter.Next()) {
+ aWindow->RemoveGamepad(iter.Key());
+ }
+
mListeners.RemoveElement(aWindow);
if (mListeners.IsEmpty()) {
StopMonitoring();
}
}
already_AddRefed<Gamepad>