From fa2a7f039bb52bbe2639ccbecc1331d3991b36e9 Mon Sep 17 00:00:00 2001 From: anthony restaino Date: Wed, 14 Jun 2017 23:08:59 -0400 Subject: [PATCH] Synchronizing access to database --- .../browser/lightning/database/bookmark/BookmarkDatabase.java | 2 +- .../browser/lightning/database/downloads/DownloadsDatabase.java | 2 +- .../acr/browser/lightning/database/history/HistoryDatabase.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/acr/browser/lightning/database/bookmark/BookmarkDatabase.java b/app/src/main/java/acr/browser/lightning/database/bookmark/BookmarkDatabase.java index bb3b929..ed66526 100644 --- a/app/src/main/java/acr/browser/lightning/database/bookmark/BookmarkDatabase.java +++ b/app/src/main/java/acr/browser/lightning/database/bookmark/BookmarkDatabase.java @@ -75,7 +75,7 @@ public class BookmarkDatabase extends SQLiteOpenHelper implements BookmarkModel */ @WorkerThread @NonNull - private SQLiteDatabase lazyDatabase() { + private synchronized SQLiteDatabase lazyDatabase() { if (mDatabase == null || !mDatabase.isOpen()) { mDatabase = getWritableDatabase(); } diff --git a/app/src/main/java/acr/browser/lightning/database/downloads/DownloadsDatabase.java b/app/src/main/java/acr/browser/lightning/database/downloads/DownloadsDatabase.java index a14faff..895205f 100644 --- a/app/src/main/java/acr/browser/lightning/database/downloads/DownloadsDatabase.java +++ b/app/src/main/java/acr/browser/lightning/database/downloads/DownloadsDatabase.java @@ -68,7 +68,7 @@ public class DownloadsDatabase extends SQLiteOpenHelper implements DownloadsMode */ @WorkerThread @NonNull - private SQLiteDatabase lazyDatabase() { + private synchronized SQLiteDatabase lazyDatabase() { if (mDatabase == null || !mDatabase.isOpen()) { mDatabase = getWritableDatabase(); } diff --git a/app/src/main/java/acr/browser/lightning/database/history/HistoryDatabase.java b/app/src/main/java/acr/browser/lightning/database/history/HistoryDatabase.java index b61fa16..8ceab08 100644 --- a/app/src/main/java/acr/browser/lightning/database/history/HistoryDatabase.java +++ b/app/src/main/java/acr/browser/lightning/database/history/HistoryDatabase.java @@ -92,7 +92,7 @@ public class HistoryDatabase extends SQLiteOpenHelper implements HistoryModel { @WorkerThread @NonNull - private SQLiteDatabase lazyDatabase() { + private synchronized SQLiteDatabase lazyDatabase() { if (mDatabase == null || !mDatabase.isOpen()) { mDatabase = this.getWritableDatabase(); }