Bug 725951 - Don't abort if mObservers is null when removing an observer from ObserversManager. r=jlebar
authorMounir Lamouri <mounir.lamouri@gmail.com>
Wed, 14 Mar 2012 19:18:26 +0100
changeset 89740 60b8a96614c81abcd3ddbddbe4dd8e96f63a36be
parent 89739 0e7fa46a9a43234c995ee442e9b81e6e2e7e2610
child 89741 cf2f1e899ee822570aa80bdd19bb53a82e90e7ae
push id22282
push usermlamouri@mozilla.com
push dateTue, 20 Mar 2012 10:40:32 +0000
treeherdermozilla-central@ee554888d071 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjlebar
bugs725951
milestone14.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 725951 - Don't abort if mObservers is null when removing an observer from ObserversManager. r=jlebar
hal/Hal.cpp
--- a/hal/Hal.cpp
+++ b/hal/Hal.cpp
@@ -173,17 +173,22 @@ public:
     mObservers->AddObserver(aObserver);
 
     if (mObservers->Length() == 1) {
       EnableNotifications();
     }
   }
 
   void RemoveObserver(Observer<InfoType>* aObserver) {
-    MOZ_ASSERT(mObservers);
+    // If mObservers is null, that means there are no observers, so removing one
+    // must be a no-op.
+    if (!mObservers) {
+      return;
+    }
+
     mObservers->RemoveObserver(aObserver);
 
     if (mObservers->Length() == 0) {
       DisableNotifications();
 
       OnNotificationsDisabled();
 
       delete mObservers;