kopia lustrzana https://github.com/ryukoposting/Signal-Android
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.fork-5.53.8
rodzic
44fa42fca4
commit
ff038e3ade
|
@ -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 job_spec")
|
||||||
instance!!.rawWritableDatabase.execSQL("DROP TABLE IF EXISTS constraint_spec")
|
instance!!.rawWritableDatabase.execSQL("DROP TABLE IF EXISTS constraint_spec")
|
||||||
instance!!.rawWritableDatabase.execSQL("DROP TABLE IF EXISTS dependency_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 Map<RecipientId, LiveRecipient> recipients;
|
||||||
private final LiveRecipient unknown;
|
private final LiveRecipient unknown;
|
||||||
private final Executor resolveExecutor;
|
private final Executor resolveExecutor;
|
||||||
private final SQLiteDatabase db;
|
|
||||||
|
|
||||||
private final AtomicReference<RecipientId> localRecipientId;
|
private final AtomicReference<RecipientId> localRecipientId;
|
||||||
private final AtomicBoolean warmedUp;
|
private final AtomicBoolean warmedUp;
|
||||||
|
@ -58,8 +57,7 @@ public final class LiveRecipientCache {
|
||||||
this.warmedUp = new AtomicBoolean(false);
|
this.warmedUp = new AtomicBoolean(false);
|
||||||
this.localRecipientId = new AtomicReference<>(null);
|
this.localRecipientId = new AtomicReference<>(null);
|
||||||
this.unknown = new LiveRecipient(context, Recipient.UNKNOWN);
|
this.unknown = new LiveRecipient(context, Recipient.UNKNOWN);
|
||||||
this.db = SignalDatabase.getRawDatabase();
|
this.resolveExecutor = ThreadUtil.trace(new FilteredExecutor(SignalExecutors.BOUNDED, () -> !SignalDatabase.inTransaction()));
|
||||||
this.resolveExecutor = ThreadUtil.trace(new FilteredExecutor(SignalExecutors.BOUNDED, () -> !db.inTransaction()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@AnyThread
|
@AnyThread
|
||||||
|
|
Ładowanie…
Reference in New Issue