From 5b788fe188f35a12e4e8da74520bd1b9c70d80c6 Mon Sep 17 00:00:00 2001 From: Jake McGinty Date: Thu, 21 May 2015 02:32:38 -0700 Subject: [PATCH] fix activity leak when initializing singletons Closes #3219 // FREEBIE --- .../securesms/database/CanonicalAddressDatabase.java | 4 ++-- src/org/thoughtcrime/securesms/database/DatabaseFactory.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/org/thoughtcrime/securesms/database/CanonicalAddressDatabase.java b/src/org/thoughtcrime/securesms/database/CanonicalAddressDatabase.java index 81ad967b5a..4fa4a783d1 100644 --- a/src/org/thoughtcrime/securesms/database/CanonicalAddressDatabase.java +++ b/src/org/thoughtcrime/securesms/database/CanonicalAddressDatabase.java @@ -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(); } diff --git a/src/org/thoughtcrime/securesms/database/DatabaseFactory.java b/src/org/thoughtcrime/securesms/database/DatabaseFactory.java index cc183160e9..161d813927 100644 --- a/src/org/thoughtcrime/securesms/database/DatabaseFactory.java +++ b/src/org/thoughtcrime/securesms/database/DatabaseFactory.java @@ -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; }