test: the worksheet check tears its pages down before their profile

Intermittently it segfaulted after every check had passed, leaving
teardown order to Python; a profile released under a live page does
that. Eight runs clean afterwards. The real Wonder Ink, closed six times
by its window's close button in the lab, exited 0 each time.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
ekklesia
2026-09-24 07:19:45 -05:00
co-authored by Claude Opus 5.5
parent 2d1cc016c5
commit 2325a5993b
+18
View File
@@ -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