bug 1025931 - Crash java.lang.NullPointerException in in org.mozilla.gecko.GeckoAppShell.getContext r=snorp
authorBrad Lassey <blassey@mozilla.com>
Thu, 26 Jun 2014 09:37:47 -0400
changeset 191858 97203a8ac74b94e8a329a2703b30066ba964534d
parent 191857 d2d2713d2959b174e1eb0432bbb8ec24a8463f4f
child 191859 d33ca5cb5df3602a43dc3848a731a00d29ce7fa7
push id45685
push usercbook@mozilla.com
push dateWed, 02 Jul 2014 13:09:48 +0000
treeherdermozilla-inbound@60133a85f8ae [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);