Bug 785166: Protect against already-canceled vibrations. r=jlebar
authorChris Jones <jones.chris.g@gmail.com>
Thu, 23 Aug 2012 17:32:00 -0700
changeset 105386 50430d101d34fbd28d5e02d20eac5d6878025287
parent 105385 e89ead1bbe389ca1a0a1e6ce5a9662dbf3881f9c
child 105387 ee747ea1354fdd302c34b092806b63eb046381b7
push id55
push usershu@rfrn.org
push dateThu, 30 Aug 2012 01:33:09 +0000
reviewersjlebar
bugs785166
milestone17.0a1
Bug 785166: Protect against already-canceled vibrations. r=jlebar
hal/Hal.cpp
--- a/hal/Hal.cpp
+++ b/hal/Hal.cpp
@@ -154,17 +154,17 @@ CancelVibrate(const WindowIdentifier &id
   //
   // To solve this problem, we keep track of the id of the last window
   // to start a vibration, and only accepts cancellation requests from
   // the same window.  All other cancellation requests are ignored.
 
   if (InSandbox()) {
     hal_sandbox::CancelVibrate(id);
   }
-  else if (*gLastIDToVibrate == id.AsArray()) {
+  else if (gLastIDToVibrate && *gLastIDToVibrate == id.AsArray()) {
     // Don't forward our ID to hal_impl. It doesn't need it, and we
     // don't want it to be tempted to read it.  The empty identifier
     // will assert if it's used.
     HAL_LOG(("CancelVibrate: Forwarding to hal_impl."));
     hal_impl::CancelVibrate(WindowIdentifier());
   }
 }