Bug 1139469 - Guard against a null compositor loop during startup on B2G. r=botond, a=bajaj
authorKartikaya Gupta <kgupta@mozilla.com>
Fri, 20 Mar 2015 15:28:04 -0400
changeset 237874 7ba1778d237b3fbc1c08b752ea09c049237ca2b3
parent 237873 e75ae086a742a721a6756bc655a178c91e123f4d
child 237875 08f4abcc335dbdb3c6f60ad5b769ae61c8463b20
push id378
push userryanvm@gmail.com
push dateMon, 23 Mar 2015 23:14:02 +0000
treeherdermozilla-b2g37_v2_2@7ba1778d237b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbotond, bajaj
bugs1139469
milestone37.0
Bug 1139469 - Guard against a null compositor loop during startup on B2G. r=botond, a=bajaj
gfx/layers/apz/util/APZThreadUtils.cpp
--- a/gfx/layers/apz/util/APZThreadUtils.cpp
+++ b/gfx/layers/apz/util/APZThreadUtils.cpp
@@ -52,16 +52,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;