mirror of
https://github.com/signalapp/Signal-Android.git
synced 2025-12-24 13:08:46 +00:00
Add extra transaction protections.
This commit is contained in:
committed by
Cody Henthorne
parent
0d37013481
commit
5c6644d1a1
@@ -17,10 +17,14 @@ inline fun <T : SupportSQLiteDatabase, R> T.withinTransaction(block: (T) -> R):
|
||||
beginTransaction()
|
||||
try {
|
||||
val toReturn = block(this)
|
||||
setTransactionSuccessful()
|
||||
if (inTransaction()) {
|
||||
setTransactionSuccessful()
|
||||
}
|
||||
return toReturn
|
||||
} finally {
|
||||
endTransaction()
|
||||
if (inTransaction()) {
|
||||
endTransaction()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user