Bug 1055166 - Catch IllegalStateException when recycling Message r=jchen
authorJames Willcox <snorp@snorp.net>
Thu, 28 Aug 2014 15:50:53 -0500
changeset 223907 181168ddad5207d805ff207c1de87e1c7e67b1ce
parent 223906 f41c1edabfe8e4c57caaca6d5b08660db3ad496d
child 223908 53d33674eb30ef1a3cd6c36722569c404e07ca03
push id3979
push userraliiev@mozilla.com
push dateMon, 13 Oct 2014 16:35:44 +0000
treeherdermozilla-beta@30f2cc610691 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjchen
bugs1055166
milestone34.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 1055166 - Catch IllegalStateException when recycling Message r=jchen
mobile/android/base/GeckoAppShell.java
--- a/mobile/android/base/GeckoAppShell.java
+++ b/mobile/android/base/GeckoAppShell.java
@@ -2478,17 +2478,26 @@ public class GeckoAppShell
             // Our "queue is empty" message; see runGecko()
             msg.recycle();
             return false;
         }
         if (msg.getTarget() == null) 
             Looper.myLooper().quit();
         else
             msg.getTarget().dispatchMessage(msg);
-        msg.recycle();
+
+        try {
+            // Bug 1055166 - this sometimes throws IllegalStateException on Android L.
+            // There appears to be no way to figure out if a message is in use or not, let
+            // alone receive a notification when it is no longer being used. Just catch
+            // the exception for now, and if a better solution comes along we can use it.
+            msg.recycle();
+        } catch (IllegalStateException e) {
+            // There is nothing we can do here so just eat it
+        }
         return true;
     }
 
     @WrapElementForJNI
     public static void notifyWakeLockChanged(String topic, String state) {
         if (getGeckoInterface() != null)
             getGeckoInterface().notifyWakeLockChanged(topic, state);
     }