Merge pull request #1384 from hikaru-y/fix-previewer-memory-leak

Fix memory leak in previewer
This commit is contained in:
Damien Elmes 2021-09-22 21:45:14 +10:00 committed by GitHub
commit 1cd911ab63
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -47,6 +47,7 @@ class Previewer(QDialog):
self, parent: QWidget, mw: AnkiQt, on_close: Callable[[], None]
) -> None:
super().__init__(None, Qt.Window)
mw.garbage_collect_on_dialog_finish(self)
self._open = True
self._parent = parent
self._close_callback = on_close
@ -123,6 +124,7 @@ class Previewer(QDialog):
def _on_close(self) -> None:
self._open = False
self._close_callback()
self._web = None
def _setup_web_view(self) -> None:
self._web.stdHtml(