bug 1025931 - Crash java.lang.NullPointerException in in org.mozilla.gecko.GeckoAppShell.getContext r=snorp
☠☠ backed out by a033a0b332eb ☠ ☠
authorBrad Lassey <blassey@mozilla.com>
Thu, 26 Jun 2014 09:37:47 -0400
changeset 191171 fd8d40d26de88b04e0999529a4131bb400c099a2
parent 191170 7f1912a46efe6ee6aac69f77d8e37affe092445a
child 191172 a9f445169eca47c05c51f7d3a7c31a0982e948e2
push id27035
push userkwierso@gmail.com
push dateFri, 27 Jun 2014 23:52:01 +0000
treeherdermozilla-central@f127b565e53f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssnorp
bugs1025931
milestone33.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 1025931 - Crash java.lang.NullPointerException in in org.mozilla.gecko.GeckoAppShell.getContext r=snorp
mobile/android/base/GeckoAppShell.java
mobile/android/base/GeckoApplication.java
--- a/mobile/android/base/GeckoAppShell.java
+++ b/mobile/android/base/GeckoAppShell.java
@@ -2090,16 +2090,18 @@ public class GeckoAppShell
             return null;
         }
     }
 
     private static ContextGetter sContextGetter;
 
     @WrapElementForJNI(allowMultithread = true)
     public static Context getContext() {
+        if (sContextGetter == null)
+            return null;
         return sContextGetter.getContext();
     }
 
     public static void setContextGetter(ContextGetter cg) {
         sContextGetter = cg;
     }
 
     public static SharedPreferences getSharedPreferences() {
--- a/mobile/android/base/GeckoApplication.java
+++ b/mobile/android/base/GeckoApplication.java
@@ -97,16 +97,18 @@ public class GeckoApplication extends Ap
                 }
             });
         }
         GeckoConnectivityReceiver.getInstance().stop();
         GeckoNetworkManager.getInstance().stop();
     }
 
     public void onActivityResume(GeckoActivityStatus activity) {
+	GeckoAppShell.setContextGetter(this);
+
         if (mPausedGecko) {
             GeckoAppShell.sendEventToGecko(GeckoEvent.createAppForegroundingEvent());
             mPausedGecko = false;
         }
 
         final Context applicationContext = getApplicationContext();
         GeckoBatteryManager.getInstance().start(applicationContext);
         GeckoConnectivityReceiver.getInstance().start(applicationContext);