mirror of
https://github.com/ankitects/anki.git
synced 2025-09-22 16:02:23 -04:00
Fix implicit transaction not being cleared on transact() failure
"release foo" clears the implicit outer transaction, but "rollback to foo" does not.
This commit is contained in:
parent
1297beff63
commit
ac1cbaf719
1 changed files with 6 additions and 1 deletions
|
@ -10,6 +10,7 @@ impl Collection {
|
|||
{
|
||||
let have_op = op.is_some();
|
||||
let skip_undo_queue = op == Some(Op::SkipUndo);
|
||||
let autocommit = self.storage.db.is_autocommit();
|
||||
|
||||
self.storage.begin_rust_trx()?;
|
||||
self.begin_undoable_operation(op);
|
||||
|
@ -43,7 +44,11 @@ impl Collection {
|
|||
// roll back on error
|
||||
.or_else(|err| {
|
||||
self.discard_undo_and_study_queues();
|
||||
self.storage.rollback_rust_trx()?;
|
||||
if autocommit {
|
||||
self.storage.rollback_trx()?;
|
||||
} else {
|
||||
self.storage.rollback_rust_trx()?;
|
||||
}
|
||||
Err(err)
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue