mirror of
https://github.com/f-droid/fdroidclient.git
synced 2026-02-05 12:42:34 -05:00
use getApplicationContext() when storing a passed in Context
getApplicationContext() returns the Context of the application, which is guaranteed to have the same life as the app itself. Other Contexts, like an Activity, might go away during runtime.
This commit is contained in:
@@ -73,7 +73,7 @@ public class LocalRepoManager {
|
||||
}
|
||||
|
||||
private LocalRepoManager(Context c) {
|
||||
context = c;
|
||||
context = c.getApplicationContext();
|
||||
pm = c.getPackageManager();
|
||||
assetManager = c.getAssets();
|
||||
prefs = PreferenceManager.getDefaultSharedPreferences(c);
|
||||
|
||||
@@ -27,7 +27,7 @@ public class LocalHTTPD extends NanoHTTPD {
|
||||
super(FDroidApp.ipAddressString, FDroidApp.port);
|
||||
this.logRequests = false;
|
||||
this.webRoot = webRoot;
|
||||
this.context = context;
|
||||
this.context = context.getApplicationContext();
|
||||
if (useHttps)
|
||||
enableHTTPS();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user