Repository navigation
fix(signals): address review follow-ups on helpers, weak slots, and macOS mirrors - #4
Merged
Merged
Conversation
…acOS mirrors - move spinRowEditableText out of Generated/SpinRow.swift into Sources/Adwaita/SpinRow+Editable.swift (internal) so regenerated Generated/SpinRow.swift still compiles; the generator already emits the call but never the definition - make signalTrampolineDragCancel / connectDragCancel take OpaquePointer? instead of OpaquePointer (the emit shim and the test pass NULL; a non-optional parameter is formally UB) - add tabViewOnClosePageReturnFalseClosesPage: a false return must fall through to the default close (nPages == 0) - add spinRowOnInputSignalDoesNotLeakRow: regression test for the old self-capture leak (verified to fail when the capture is temporarily restored) - route g_object_add_weak_pointer through a stable heap slot (WeakPointerSlot) instead of &local, which Swift only guarantees for the duration of the call - add the missing one-to-one XCTest mirrors for the new signal tests and rename test_tabOverviewCreateTabSignal to test_tabOverviewCreateTabSignalConnect
WeakPointerSlot.deinit now drops the g_object_add_weak_pointer registration when the watched object is still alive, so GLib can no longer write into a freed slot during a later finalization (e.g. when a test fails early and the object outlives the slot). Drop the unused GObjectSupport import from SpinRow+Editable.swift.
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.
Review follow-ups on the value-returning signal series (49a476d, b8dee0c):
Sources/Adwaita/Generated/SpinRow.swiftintoSources/Adwaita/SpinRow+Editable.swift(internal), so a regeneratedGenerated/SpinRow.swiftcompiles — the generator emits the call but never the definition. Verified by building the codegen fromTools/AdwaitaCodeGen, running it from an empty dir, and diffing theonInput/onOutput/onGetNextPage/onClosePage/onCreateWindow/onCreateTabbodies against the repo files (identical; doc-comment/manual divergences left untouched per the workflow).tabViewOnClosePageReturnFalseClosesPage: handler returnsfalseand does not callclosePageFinish→ the default close must happen (nPages == 0).signalTrampolineDragCanceland theconnectDragCancelcast now takeOpaquePointer?instead ofOpaquePointer— the emit shim and the test passNULL, which was formally UB.spinRowOnInputSignalDoesNotLeakRow: creates aSpinRow, connectsonInput, drops the wrapper, spins the main loop, and asserts the C object finalized via a weak pointer. Verified it fails when the oldselfcapture is temporarily restored, then reverted.WeakPointerSlottest helper: allocate/initialize/deallocate) tog_object_add_weak_pointerinstead of&local, whose address Swift only guarantees for the duration of the call.test_tabOverviewCreateTabSignal→test_tabOverviewCreateTabSignalConnect. Main-loop tests (navigationViewOnGetNextPageFinalizesOnce,tabOverviewCreateTabSignalAddsAndFinalizesPage, the new leak test) stay swift-testing-only per CONTRIBUTING.md.Checks (local):
swift build && swift build --build-tests— cleanxvfb-run -a swift test --no-parallel— 1322 + 10 passed (was 1320 + 10)swiftformat 0.60.1 --lint Sources/ Tests/— 0 violations