The following runtime warning is emitted by Xcode when using the manageSubscriptionsSheet with an ObservableObject:
\ContentViewModel.isPresented is isolated to the main actor. Accessing it via Binding from a different actor will cause undefined behaviors, and potential data races; This warning will become a runtime crash in a future version of SwiftUI.
Publishing changes from background threads is not allowed; make sure to publish values from the main thread (via operators like receive(on:)) on model updates.
This minimal sample project reproduces the issue:
class ContentViewModel: ObservableObject {
@Published var isPresented = false
func didTapButton() { self.isPresented = true }
}
struct ContentView: View {
@ObservedObject var viewModel: ContentViewModel
var body: some View {
Button("Tap me") { self.viewModel.didTapButton() }
.manageSubscriptionsSheet(isPresented: self.$viewModel.isPresented)
}
}
Reproduced on:
Xcode 16.2
Xcode 16.3 beta
both with a simulator and a real device.
This doesn't happen when using @Observable.
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
Hello,
since the release of iOS 16 we see a crash EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x0000000000000158 when invoking CIContext.startTask(toRender image: CIImage, to destination: CIRenderDestination) in the custom video compositor of our app.
The crash happens exclusively on iOS16. The same call runs fine on iOS 15 and lower. By looking at the crashlytics logs, the crash occurs mostly on iPhone12 (~50% of the occurrences).
We are not able to reproduce the bug, as it occurs very randomly.
Any suggestion on how to fix this? Or is it a regression on the new OS?
Stack trace:
Thread 7 name:
Thread 7 Crashed:
0 AGXMetalG14 0x00000002060e5b2c AGX::ResourceGroupUsage<AGX::G14::Encoders, AGX::G14::Classes, AGX::G14::ObjClasses>::setTexture(AGXG14FamilyTexture const*, ResourceGroupBindingType, unsigned int) + 40 (agxa_texture_template.h:423)
1 AGXMetalG14 0x000000020601d428 -[AGXG14FamilyComputeContext setTexture:atIndex:] + 168 (agxa_compute_template.hpp:3119)
2 CoreImage 0x000000019b5eb048 CIMetalRenderToTextures + 744 (CIMetalUtils.m:1348)
3 CoreImage 0x000000019b6de5a4 CI::MetalContext::compute_quad(unsigned int, CI::MetalMainProgram const*, CGSize const&, void const**, unsigned long, CI::Dimensions, CI::Dimensions) + 864 (context-metal.mm:1206)
4 CoreImage 0x000000019b6df0e4 CI::MetalContext::render_node(CI::TileTask*, CI::ProgramNode*, CGRect const&, CGRect const&, void const**, __IOSurface**, unsigned long) + 1352 (context-metal.mm:1463)
5 CoreImage 0x000000019b6e0208 CI::MetalContext::render_intermediate_node(CI::TileTask*, CI::ProgramNode*, CGRect const&, CI::intermediate_t*, bool, void () block_pointer) + 472 (context-metal.mm:1621)
6 CoreImage 0x000000019b6e340c CI::Context::recursive_render(CI::TileTask*, CI::roiKey const&, CI::Node*, bool) + 3584 (context.cpp:477)
7 CoreImage 0x000000019b6e2bb4 CI::Context::recursive_render(CI::TileTask*, CI::roiKey const&, CI::Node*, bool) + 1448 (context.cpp:402)
8 CoreImage 0x000000019b6e3c78 CI::Context::render(CI::ProgramNode*, CGRect const&) + 160 (context.cpp:535)
9 CoreImage 0x000000019b7502e4 ___ZN2CI23image_render_to_surfaceEPNS_7ContextEPNS_5ImageE6CGRectP11__IOSurfacePKNS_17RenderDestinationE_block_invoke + 72 (render.cpp:2595)
10 CoreImage 0x000000019b754078 CI::recursive_tile(CI::RenderTask*, CI::Context*, CI::RenderDestination const*, char const*, CI::Node*, CGRect const&, CI::PixelFormat, CI::swizzle_info const&, CI::TileTask* (CI::ProgramNode*, CGR... + 4428 (render.cpp:1824)
11 CoreImage 0x000000019b74ebe4 CI::tile_node_graph(CI::Context*, CI::RenderDestination const*, char const*, CI::Node*, CGRect const&, CI::PixelFormat, CI::swizzle_info const&, CI::TileTask* (CI::ProgramNode*, CGRect) block_pointer) + 444 (render.cpp:1929)
12 CoreImage 0x000000019b74fa54 CI::image_render_to_surface(CI::Context*, CI::Image*, CGRect, __IOSurface*, CI::RenderDestination const*) + 1916 (render.cpp:2592)
13 CoreImage 0x000000019b62e7b4 -[CIContext(CIRenderDestination) _startTaskToRender:toDestination:forPrepareRender:forClear:error:] + 2084 (CIRenderDestination.mm:1943)
Crash report:
report.crash