Bug 1139469 - Guard against a null compositor loop during startup on B2G. r=botond
authorKartikaya Gupta <kgupta@mozilla.com>
Fri, 20 Mar 2015 15:28:04 -0400
changeset 263654 eef7b20f0341c7a74816fd3da80a5c5657af63c8
parent 263653 824009fbc42fed138b9ff0b9d1ee44e8502773dd
child 263655 5444d8c669fc5d1ba1dea10dd8b53c1bf40df130
push id4718
push userraliiev@mozilla.com
push dateMon, 11 May 2015 18:39:53 +0000
treeherdermozilla-beta@c20c4ef55f08 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbotond
bugs1139469
milestone39.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 1139469 - Guard against a null compositor loop during startup on B2G. r=botond
gfx/layers/apz/util/APZThreadUtils.cpp
--- a/gfx/layers/apz/util/APZThreadUtils.cpp
+++ b/gfx/layers/apz/util/APZThreadUtils.cpp
@@ -51,16 +51,22 @@ APZThreadUtils::AssertOnCompositorThread
 
 /*static*/ void
 APZThreadUtils::RunOnControllerThread(Task* aTask)
 {
 #ifdef MOZ_WIDGET_GONK
   // On B2G the controller thread is the compositor thread, and this function
   // is always called from the libui thread or the main thread.
   MessageLoop* loop = CompositorParent::CompositorLoop();
+  if (!loop) {
+    // Could happen on startup
+    NS_WARNING("Dropping task posted to controller thread\n");
+    delete aTask;
+    return;
+  }
   MOZ_ASSERT(MessageLoop::current() != loop);
   loop->PostTask(FROM_HERE, aTask);
 #else
   // On non-B2G platforms this is only ever called from the controller thread
   // itself.
   AssertOnControllerThread();
   aTask->Run();
   delete aTask;