imgui icon indicating copy to clipboard operation
imgui copied to clipboard

MacOS runtime warnings regarding access of NSView/NSWindow properties from a non-main thread

Open tim-rex opened this issue 4 months ago • 1 comments

Xcode Version 15.3 (15E204a)

Resolve Xcode runtime warnings regarding access of NSView/NSWindow properties from a non-main thread This issue presents when rendering from a thread that is other than the window thread, more easily reproduced when disabling vsync

This commit aims to populate the relevant data into backend_data, by way of dispatch_async (ocurring on the main thread). Those particular backend data items are protected by an NSlock

There may be more elegant ways to do this

The warnings observed are as follows: Main Thread Checker

imgui/backends/imgui_impl_osx.mm:608 -[NSView window] must be used from main thread only
imgui/backends/imgui_impl_osx.mm:608 -[NSWindow backingScaleFactor] must be used from main thread only
imgui/backends/imgui_impl_osx.mm:609 -[NSView bounds] must be used from main thread only

tim-rex avatar Mar 12 '24 05:03 tim-rex

Also see #6528

ocornut avatar Mar 12 '24 09:03 ocornut