fix error in webview __del__ on shutdown

This commit is contained in:
Damien Elmes 2021-10-12 17:07:07 +10:00
parent 5600d2824c
commit a403b957cc

View file

@ -664,6 +664,10 @@ document.head.appendChild(style);
self._page.setContent(cast(QByteArray, bytes("", "ascii"))) self._page.setContent(cast(QByteArray, bytes("", "ascii")))
def __del__(self) -> None: def __del__(self) -> None:
from aqt import mw try:
from aqt import mw
except ImportError:
# this will fail when __del__ is called during app shutdown
return
mw.mediaServer.clear_page_html(id(self)) mw.mediaServer.clear_page_html(id(self))