Repository navigation
DeferredCallback: one lifetime owner, not two - #57
Merged
Merged
Conversation
The owner is the one owner. DeferredCallback.setSingleShot(True) stops the timer after one delivery; the owner's destruction cascade cleans it up. The old self.deleteLater() inside _invoke posted a DeferredDelete that raced the owner's own child-cascade delete, and under PySide the wrapper still ran QTimer::~QTimer -> QTimer::stop against freed property-binding storage. The full suite segfaulted at 66% in tests/test_widget_tree_projection.py::test_nominal_widget_projectors_own_indexed_selection (bus 2f8b474c7a7c). IDEN-5 at src/pyqt_reactive/core/deferred_callback.py:32. A regression test rebuilds the specimen: a DeferredCallback whose parent is a local QComboBox dropped mid-event-loop. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016gZLdupVQyBzHTmHBC9Cyn
This was referenced Nov 17, 2026
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.
Summary
deleteLater()from inside its own slot. The owner QObject's destruction cascade is the one lifetime owner;setSingleShot(True)already stops the timer after one delivery.test_parentless_owner_drop_mid_eventloop_does_not_segfaultrebuilds the specimen from bus message2f8b474c7a7c: a DeferredCallback whose owner is a local QComboBox dropped between twoprocessEvents()calls.test_deferred_callback_runs_once_and_retires(renamed_and_owner_owns_it) to assert the owner-owned semantics: timer stays as a child of the owner after firing, dies with the owner.Why
Bus
2f8b474c7a7cshowed the full suite SIGSEGV'ing at ~66% intests/test_widget_tree_projection.py::test_nominal_widget_projectors_own_indexed_selection:self.deleteLater()inside_invokeposted aDeferredDeletethat raced the owner's own child-cascade delete. Qt'sremovePostedEventsprotects plain QTimer children, but the PySide wrapper for a Python-subclass QTimer still ranQTimer::~QTimeragainst freed property-binding storage. The second owner was the slot itself. slop.md IDEN-5: one lifetime owner, not two.Test plan
tests/test_deferred_callback.py13 passed on the runtime python (3.14.8, PySide6 6.12.0, offscreen).test_declared_form.py:86crash duringQTest.qWait(300)— pre-existing QWidget lifetime bug, not a regression of this change.🤖 Generated with Claude Code
https://claude.ai/code/session_016gZLdupVQyBzHTmHBC9Cyn