mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-05-08 09:18:39 +01: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.version = newVersion
|
||||||
db.setTransactionSuccessful()
|
db.setTransactionSuccessful()
|
||||||
} finally {
|
} 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)
|
// We have to re-begin the transaction for the calling code (see comment at start of method)
|
||||||
db.beginTransaction()
|
db.beginTransaction()
|
||||||
|
|||||||
@@ -29,6 +29,12 @@ class SqlCipherErrorHandler(private val databaseName: String) : DatabaseErrorHan
|
|||||||
|
|
||||||
if (result is DiagnosticResults.Success) {
|
if (result is DiagnosticResults.Success) {
|
||||||
if (result.pragma1Passes && result.pragma2Passes) {
|
if (result.pragma1Passes && result.pragma2Passes) {
|
||||||
|
var endCount = 0
|
||||||
|
while (db.inTransaction() && endCount < 10) {
|
||||||
|
db.endTransaction()
|
||||||
|
endCount++
|
||||||
|
}
|
||||||
|
|
||||||
attemptToClearFullTextSearchIndex()
|
attemptToClearFullTextSearchIndex()
|
||||||
throw DatabaseCorruptedError_BothChecksPass(lines)
|
throw DatabaseCorruptedError_BothChecksPass(lines)
|
||||||
} else if (!result.pragma1Passes && result.pragma2Passes) {
|
} else if (!result.pragma1Passes && result.pragma2Passes) {
|
||||||
|
|||||||
Reference in New Issue
Block a user