2.5 KiB
Window lifecycle fix review — 2026-10-19
Scope
Reviewed the current narrow main_window.py diff adding shiboken6.isValid guards to ServiceWorker callbacks, the parameterized forced-window-destruction regression in tests/ui/test_trial_task_center_workflow.py, and the surrounding worker/ordinary-close behavior. No tests, CAD, source edits, or Git mutations were performed; this report is the only output written.
Findings
- Critical: None.
- Important: None.
- Minor: None raised.
Assessment
Approved for this narrow lifecycle fix.
The successful callback checks C++ object validity before any window/widget work. The failed callback returns before _finish_run, error display, or other widget access when the window is destroyed or closed. The finished callback always removes its worker from the Python set, then checks validity before touching the plan panel, close timer, or gates. These guards address each callback path visible in the original deleted-widget failure.
For live windows, the existing generation/owner checks, error handling, plan cleanup, and pending-close scheduling remain in place. Ordinary close requests still wait for active workers and request cancellation/boundary pause. The change suppresses presentation callbacks after destruction; it does not cancel service work or release execution protection early. Service worker completion still emits its final cleanup signal through finally.
The new test blocks an actual ServiceWorker, force-deletes a separate window through Qt deferred deletion, then releases the worker. It covers both success and a raised exception. The primary fixture window remains alive, avoiding the earlier teardown misuse of a deleted fixture window. Qt event-loop exception reporting complements the assertion that the application success callback is not delivered. This restores coverage of the separate mutation-worker path identified during the migration review.
Evidence inspected
build/release-ui-destruction-20261019.xml: 1 failed test and 1 teardown error. The failure contains deleted QLabel access fromsucceededand deleted QPushButton access fromfinished; the teardown error is separately identifiable as use of the deleted fixture window.build/release-ui-lifecycle-final-20261019.xml: 54 tests, 0 failures, 0 errors, 0 skipped. Includes bothtest_destroyed_window_cannot_receive_late_worker_ui_callbacks[False]and[True].
These are existing test artifacts inspected read-only, not tests rerun by this reviewer. No live CAD behavior was exercised.