mirror of
https://github.com/signalapp/Signal-Android.git
synced 2025-12-23 20:48:43 +00:00
End transaction before handling db error.
This commit is contained in:
@@ -168,7 +168,9 @@ open class SignalDatabase(private val context: Application, databaseSecret: Data
|
||||
db.version = newVersion
|
||||
db.setTransactionSuccessful()
|
||||
} finally {
|
||||
db.endTransaction()
|
||||
if (db.inTransaction()) {
|
||||
db.endTransaction()
|
||||
}
|
||||
|
||||
// We have to re-begin the transaction for the calling code (see comment at start of method)
|
||||
db.beginTransaction()
|
||||
|
||||
@@ -29,6 +29,12 @@ class SqlCipherErrorHandler(private val databaseName: String) : DatabaseErrorHan
|
||||
|
||||
if (result is DiagnosticResults.Success) {
|
||||
if (result.pragma1Passes && result.pragma2Passes) {
|
||||
var endCount = 0
|
||||
while (db.inTransaction() && endCount < 10) {
|
||||
db.endTransaction()
|
||||
endCount++
|
||||
}
|
||||
|
||||
attemptToClearFullTextSearchIndex()
|
||||
throw DatabaseCorruptedError_BothChecksPass(lines)
|
||||
} else if (!result.pragma1Passes && result.pragma2Passes) {
|
||||
|
||||
Reference in New Issue
Block a user