diff --git a/tools/lab/pdf-check b/tools/lab/pdf-check index 95f6887..4dc2c26 100755 --- a/tools/lab/pdf-check +++ b/tools/lab/pdf-check @@ -135,5 +135,23 @@ check("and the window will open exactly that path", window.may_open(spaces)) print() print(f"{passed} passed, {failed} failed") + +# Pages go before their profile. Left to Python's own teardown the order +# is arbitrary, and a profile released while a page still uses it is a +# segfault on the way out — measured, intermittently, AFTER every check +# had passed, which made a passing run report failure. The real Wonder +# Ink was closed six times in the same lab and exited 0 each time. +from PyQt6.QtCore import QCoreApplication, QEvent + +for index in range(window._tabs.count()): + view = window._tabs.widget(index) + view.page().deleteLater() + view.deleteLater() +window.close() +window.deleteLater() +QCoreApplication.sendPostedEvents(None, QEvent.Type.DeferredDelete.value) +profile.deleteLater() +QCoreApplication.sendPostedEvents(None, QEvent.Type.DeferredDelete.value) +sys.stdout.flush() sys.exit(1 if failed else 0) PY