mirror of
https://github.com/ankitects/anki.git
synced 2025-09-20 15:02:21 -04:00
if db lock fails, explicitly close database
on Windows at least, the database file otherwise remains locked after an exception is raised on a read only file
This commit is contained in:
parent
4168c01141
commit
6a8ea9e65b
1 changed files with 5 additions and 1 deletions
|
@ -63,7 +63,11 @@ def Collection(
|
||||||
addBasicModel(col)
|
addBasicModel(col)
|
||||||
col.save()
|
col.save()
|
||||||
if lock:
|
if lock:
|
||||||
col.lock()
|
try:
|
||||||
|
col.lock()
|
||||||
|
except:
|
||||||
|
col.db.close()
|
||||||
|
raise
|
||||||
return col
|
return col
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue