mirror of
https://github.com/ankitects/anki.git
synced 2025-09-25 01:06:35 -04:00
fix 'open backup' opening to an empty deck list
Starting the import in a timer could cause the collection to be unloaded while the deck list was being displayed, leading to an inconsistent state. The timer was originally required to avoid importing on startup, but profile load is already delayed until after startup these days, so the workaround should no longer be necessary.
This commit is contained in:
parent
c3dc02cd7f
commit
3716feb1c4
1 changed files with 2 additions and 4 deletions
|
@ -384,10 +384,8 @@ This will delete your existing collection and replace it with the data in \
|
|||
the file you're importing. Are you sure?"""), msgfunc=QMessageBox.warning,
|
||||
defaultno=True):
|
||||
return False
|
||||
# schedule replacement; don't do it immediately as we may have been
|
||||
# called as part of the startup routine
|
||||
mw.progress.timer(
|
||||
100, lambda mw=mw, f=importer.file: replaceWithApkg(mw, f, mw.restoringBackup), False)
|
||||
|
||||
replaceWithApkg(mw, importer.file, mw.restoringBackup)
|
||||
|
||||
def replaceWithApkg(mw, file, backup):
|
||||
mw.unloadCollection(lambda: _replaceWithApkg(mw, file, backup))
|
||||
|
|
Loading…
Reference in a new issue