Fix the app target's compiler warnings - #118
Merged
Merged
Conversation
With the target's default MainActor isolation, extensions of nonisolated types were main-actor isolated again, so pixel and export code that runs on workers called into the main actor. Mark those extensions and helpers nonisolated, make MetalLayerEffects Sendable (it only holds Metal objects, which are thread-safe), run the floating panel's frame observer through MainActor.assumeIsolated, and fix a long-to-int narrowing in AdjustPixels.c and a var that is never mutated.
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.
The app target built with 17 compiler warnings. This clears all of them, without changing behavior.
Most came from the target's default
MainActorisolation: extensions ofnonisolatedtypes are main-actor isolated again unless they say otherwise, so pixel and export code that runs on workers was calling into the main actor.nonisolatedon theCameraRawSettingsextensions (calibration, curve/color, detail/optics),ProjectLayerRecord.effectiveOpacity,ImageLayer.size,UTType.photoshopImage/.photoshopLargeImageandEditorSession.textAttributesMetalLayerEffectsis nownonisolatedandSendable: export calls it from a worker, and it only holds a device, a command queue and pipeline states, which are allSendableand thread-safeMainActor.assumeIsolated(it is registered on.main), asEditorCanvasalready does for its autoscroll timerAdjustPixels.c: the lateral chromatic aberration offsets areint, matchingclamped_indexCameraRawGeometryCalibration: avarthat is never mutated is nowletTested with Xcode 27.0 on macOS 27 (Apple silicon), in a clean build: no warnings in the app target. The unit tests pass (parallel suite and
FloatingPanelTests). Two things are unchanged and not part of this PR:TiledLayerTests.swift:242/244warn thattry #require(…)has nothing to throw. I left it alone because removingtrymay not build with the Xcode 26.6 that CI uses.SliderSnapTests.clickingTheTrackSnapsTheKnobAndStillEditsTheValuefails on macOS 27 without these changes too: it finds no slider in the hosting view.