agrosner / agrosner/DBFlow

ReOpen and BackupEnabled

Aperta
#1,709 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Kotlin
Stelle
4.8k
Fork
593
Merge medio
1m
PR unite (30g)
1

Descrizione

DBFlow Version: 4.2.4

Bug Request:
When database is reopen and using backupEnabled then after while following error happen:
E/Database: close() was never explicitly called on database '{dbpath}/temp-{dbname}.db'
database.DatabaseObjectNotClosedException: Application did not close the cursor or database object that was opened here
at net.sqlcipher.database.SQLiteDatabase.(SQLiteDatabase.java:2402)
at net.sqlcipher.database.SQLiteDatabase.openDatabase(SQLiteDatabase.java:1148)
at net.sqlcipher.database.SQLiteDatabase.openOrCreateDatabase(SQLiteDatabase.java:1212)
at net.sqlcipher.database.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:162)
at net.sqlcipher.database.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:129)
at com.raizlabs.android.dbflow.sqlcipher.SQLCipherOpenHelper$BackupHelper.getDatabase(SQLCipherOpenHelper.java:125)
at com.raizlabs.android.dbflow.structure.database.DatabaseHelperDelegate.movePrepackagedDB(DatabaseHelperDelegate.java:133)

Description:
This problem happen for calling backupHelper.getDatabase(); in DatabaseHelperDelegate. I am not sure why it is called in performRestoreFromBackup() function so I overwrite it without checking if backupHelper exists and calling getDatabase(). With that modification I can simply use (DatabaseDefinition).reopen without problems. Only when db will be corrupted then movePrepackagedDB will be used where inside system check integrity of temp database and then I see this error.

I think something needs to be done around close database to also close temp database (in reopen function).

Kind regards, Krzysztof

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.