fix activity leak when initializing singletons

Closes #3219
// FREEBIE
This commit is contained in:
Jake McGinty 2015-05-21 02:32:38 -07:00 committed by Moxie Marlinspike
parent 1beed21032
commit 5b788fe188
2 changed files with 3 additions and 3 deletions

View File

@ -56,7 +56,7 @@ public class CanonicalAddressDatabase {
public static CanonicalAddressDatabase getInstance(Context context) {
synchronized (lock) {
if (instance == null)
instance = new CanonicalAddressDatabase(context);
instance = new CanonicalAddressDatabase(context.getApplicationContext());
return instance;
}
@ -69,7 +69,7 @@ public class CanonicalAddressDatabase {
public void reset(Context context) {
DatabaseHelper old = this.databaseHelper;
this.databaseHelper = new DatabaseHelper(context, DATABASE_NAME, null, DATABASE_VERSION);
this.databaseHelper = new DatabaseHelper(context.getApplicationContext(), DATABASE_NAME, null, DATABASE_VERSION);
old.close();
fillCache();
}

View File

@ -85,7 +85,7 @@ public class DatabaseFactory {
public static DatabaseFactory getInstance(Context context) {
synchronized (lock) {
if (instance == null)
instance = new DatabaseFactory(context);
instance = new DatabaseFactory(context.getApplicationContext());
return instance;
}