Repository navigation
Drop a pending flash registration when Qt destroys its widget (0.3.30) - #19
Merged
Merged
Conversation
The flash coordinator held registrations for widgets outside a flash window (QMainWindow/QDialog) for the life of the process and called widget.isVisible()/window() on every local flash, relying on RuntimeError for deleted widgets. A wrapper of a Qt-created widget, such as a scroll area's viewport reached through parentWidget(), is not always marked deleted by sip, so that call read freed memory and segfaulted. Each pending registration now ends when Qt destroys its widget or any widget its element closes over; the RuntimeError probe is gone. 0.3.30. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Cause
_GlobalFlashCoordinatorkeeps flash registrations whose widget is not yet inside a flash window (QMainWindow/QDialog). Nothing removed them except a successful attach, so registrations for widgets that never reach such a window (embedded forms, test widgets) piled up for the life of the process. On every local flash,_process_pending_registrationscalledwidget.isVisible()andwidget.window()on each one and relied onRuntimeErrorto skip deleted widgets.A wrapper of a Qt-created widget, such as a
QScrollAreaviewport reached throughparentWidget(), is not always marked deleted by sip. In the OpenHCS unit suite, Qt destroyed such a viewport (itsdestroyedsignal fired) whilesip.isdeletedstayedFalse. The next flush then calledwindow()on freed memory and segfaulted. This crashed an xdist worker intest_image_browser_streaming_config.py(OpenHCS B3).Fix
_PendingRegistration. When it is added, a_DestructionCallbackis attached to its widget and to every lifecycle widget its element closes over, so Qt destruction of any of them drops the registration. This is the same mechanism the mixin already uses for its own registration records._process_pending_registrationsno longer probes deleted widgets or catchesRuntimeError. A pending registration always refers to live widgets.Tests
test_pending_registration_ends_with_every_widget_it_closes_over: a viewport-backed registration and a leaf registration are dropped when the viewport or leaf is destroyed.pytest tests -n 2against the worktree libraries: 610 passed.🤖 Generated with Claude Code