make sure change note type clears up hooks

if an error occurred after QDialog.accept() had been called,
the hook was left lying around and caused errors when reset later
fired

File "aqt\main.py", line 1028, in onCheckDB
  File "aqt\main.py", line 516, in reset
  File "anki\hooks.py", line 28, in runHook
  File "aqt\modelchooser.py", line 47, in onReset
  File "aqt\modelchooser.py", line 82, in updateModels
<class 'RuntimeError'>: wrapped C/C++ object of type QPushButton has been deleted
This commit is contained in:
Damien Elmes 2018-12-15 12:45:17 +10:00
parent 748f362695
commit ba9ebcf8f9

View File

@ -2063,7 +2063,6 @@ Any cards mapped to nothing will be deleted. \
If a note has no remaining cards, it will be lost. \
Are you sure you want to continue?""")):
return
QDialog.accept(self)
self.browser.mw.checkpoint(_("Change Note Type"))
b = self.browser
b.mw.col.modSchema(check=True)
@ -2076,6 +2075,7 @@ Are you sure you want to continue?""")):
b.mw.progress.finish()
b.mw.reset()
self.cleanup()
QDialog.accept(self)
def onHelp(self):
openHelp("browsermisc")