Fix some issues with restoring old backups.
There's a bug where if you restore a database with a different column definition order than a new install, then column indexes in cursors could be wrong. Closing and re-opening the database fixes this. I also removed a reference to a possibly-closed database we were holding onto in LiveRecipient.
This commit is contained in:
parent
44fa42fca4
commit
ff038e3ade
2 changed files with 4 additions and 3 deletions
|
@ -237,6 +237,9 @@ open class SignalDatabase(private val context: Application, databaseSecret: Data
|
|||
instance!!.rawWritableDatabase.execSQL("DROP TABLE IF EXISTS job_spec")
|
||||
instance!!.rawWritableDatabase.execSQL("DROP TABLE IF EXISTS constraint_spec")
|
||||
instance!!.rawWritableDatabase.execSQL("DROP TABLE IF EXISTS dependency_spec")
|
||||
|
||||
instance!!.rawWritableDatabase.close()
|
||||
triggerDatabaseAccess()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -45,7 +45,6 @@ public final class LiveRecipientCache {
|
|||
private final Map<RecipientId, LiveRecipient> recipients;
|
||||
private final LiveRecipient unknown;
|
||||
private final Executor resolveExecutor;
|
||||
private final SQLiteDatabase db;
|
||||
|
||||
private final AtomicReference<RecipientId> localRecipientId;
|
||||
private final AtomicBoolean warmedUp;
|
||||
|
@ -58,8 +57,7 @@ public final class LiveRecipientCache {
|
|||
this.warmedUp = new AtomicBoolean(false);
|
||||
this.localRecipientId = new AtomicReference<>(null);
|
||||
this.unknown = new LiveRecipient(context, Recipient.UNKNOWN);
|
||||
this.db = SignalDatabase.getRawDatabase();
|
||||
this.resolveExecutor = ThreadUtil.trace(new FilteredExecutor(SignalExecutors.BOUNDED, () -> !db.inTransaction()));
|
||||
this.resolveExecutor = ThreadUtil.trace(new FilteredExecutor(SignalExecutors.BOUNDED, () -> !SignalDatabase.inTransaction()));
|
||||
}
|
||||
|
||||
@AnyThread
|
||||
|
|
Loading…
Add table
Reference in a new issue