UI API called from background thread


#1

If I use open gl renderer on 10.13 I have four UI API called from background thread warnings at runtime :

juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm: runtime: UI API called from background thread: -[NSView frame] must be used from main thread only

more

#0 0x000000010b6dbe1b in juce::NSViewComponentPeer::getBounds(bool) const at examples/audio plugin demo/Builds/MacOSX/…/…/…/…/modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm:276
#1 0x000000010b6da314 in juce::NSViewComponentPeer::localToGlobal(juce::Point) at examples/audio plugin demo/Builds/MacOSX/…/…/…/…/modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm:306
#2 0x000000010b65b7db in juce::ComponentPeer::localToGlobal(juce::Point) at examples/audio plugin demo/Builds/MacOSX/…/…/…/…/modules/juce_gui_basics/windows/juce_ComponentPeer.cpp:403
#3 0x000000010b65b84f in juce::ComponentPeer::localToGlobal(juce::Rectangle const&) at examples/audio plugin demo/Builds/MacOSX/…/…/…/…/modules/juce_gui_basics/windows/juce_ComponentPeer.cpp:408
#4 0x000000010b57a625 in juce::Rectangle juce::Component::ComponentHelpers::convertToParentSpace<juce::Rectangle >(juce::Component const&, juce::Rectangle) at examples/audio plugin demo/Builds/MacOSX/…/…/…/…/modules/juce_gui_basics/components/juce_Component.cpp:351
#5 0x000000010b5759cd in juce::Rectangle juce::Component::ComponentHelpers::convertCoordinate<juce::Rectangle >(juce::Component const*, juce::Component const*, juce::Rectangle) at examples/audio plugin demo/Builds/MacOSX/…/…/…/…/modules/juce_gui_basics/components/juce_Component.cpp:389
#6 0x000000010b575189 in juce::Component::localAreaToGlobal(juce::Rectangle) const at examples/audio plugin demo/Builds/MacOSX/…/…/…/…/modules/juce_gui_basics/components/juce_Component.cpp:1086
#7 0x000000010b575100 in juce::Component::getScreenBounds() const at examples/audio plugin demo/Builds/MacOSX/…/…/…/…/modules/juce_gui_basics/components/juce_Component.cpp:1052
#8 0x000000010b795a76 in juce::OpenGLContext::CachedImage::updateViewportSize(bool) at examples/audio plugin demo/Builds/MacOSX/…/…/…/…/modules/juce_opengl/opengl/juce_OpenGLContext.cpp:282
#9 0x000000010b79521d in juce::OpenGLContext::CachedImage::renderFrame() at examples/audio plugin demo/Builds/MacOSX/…/…/…/…/modules/juce_opengl/opengl/juce_OpenGLContext.cpp:233
#10 0x000000010b7925cc in juce::OpenGLContext::CachedImage::runJob() at examples/audio plugin demo/Builds/MacOSX/…/…/…/…/modules/juce_opengl/opengl/juce_OpenGLContext.cpp:456
#11 0x000000010b7926d9 in non-virtual thunk to juce::OpenGLContext::CachedImage::runJob() ()
#12 0x000000010b3b2f28 in juce::ThreadPool::runNextJob(juce::ThreadPool::ThreadPoolThread&) at examples/audio plugin demo/Builds/MacOSX/…/…/…/…/modules/juce_core/threads/juce_ThreadPool.cpp:389
#13 0x000000010b405c52 in juce::ThreadPool::ThreadPoolThread::run() at examples/audio plugin demo/Builds/MacOSX/…/…/…/…/modules/juce_core/threads/juce_ThreadPool.cpp:37
#14 0x000000010b3afae0 in juce::Thread::threadEntryPoint() at examples/audio plugin demo/Builds/MacOSX/…/…/…/…/modules/juce_core/threads/juce_Thread.cpp:96
#15 0x000000010b3aff65 in juce::juce_threadEntryPoint(void*) at examples/audio plugin demo/Builds/MacOSX/…/…/…/…/modules/juce_core/threads/juce_Thread.cpp:114
#16 0x000000010b3d220e in ::threadEntryProc(void *) at examples/audio plugin demo/Builds/MacOSX/…/…/…/…/modules/juce_core/native/juce_posix_SharedCode.h:926
#17 0x00000001010ee6b9 in _pthread_body ()
#18 0x00000001010ee565 in _pthread_start ()
#19 0x00000001010edc55 in thread_start ()

juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm: runtime: UI API called from background thread: -[NSView window] must be used from main thread only

more

#0 0x000000010b6dbe4f in juce::NSViewComponentPeer::getBounds(bool) const at examples/audio plugin demo/Builds/MacOSX/…/…/…/…/modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm:277
#1 0x000000010b6da314 in juce::NSViewComponentPeer::localToGlobal(juce::Point) at examples/audio plugin demo/Builds/MacOSX/…/…/…/…/modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm:306
#2 0x000000010b65b7db in juce::ComponentPeer::localToGlobal(juce::Point) at examples/audio plugin demo/Builds/MacOSX/…/…/…/…/modules/juce_gui_basics/windows/juce_ComponentPeer.cpp:403
#3 0x000000010b65b84f in juce::ComponentPeer::localToGlobal(juce::Rectangle const&) at examples/audio plugin demo/Builds/MacOSX/…/…/…/…/modules/juce_gui_basics/windows/juce_ComponentPeer.cpp:408
#4 0x000000010b57a625 in juce::Rectangle juce::Component::ComponentHelpers::convertToParentSpace<juce::Rectangle >(juce::Component const&, juce::Rectangle) at examples/audio plugin demo/Builds/MacOSX/…/…/…/…/modules/juce_gui_basics/components/juce_Component.cpp:351
#5 0x000000010b5759cd in juce::Rectangle juce::Component::ComponentHelpers::convertCoordinate<juce::Rectangle >(juce::Component const*, juce::Component const*, juce::Rectangle) at examples/audio plugin demo/Builds/MacOSX/…/…/…/…/modules/juce_gui_basics/components/juce_Component.cpp:389
#6 0x000000010b575189 in juce::Component::localAreaToGlobal(juce::Rectangle) const at examples/audio plugin demo/Builds/MacOSX/…/…/…/…/modules/juce_gui_basics/components/juce_Component.cpp:1086
#7 0x000000010b575100 in juce::Component::getScreenBounds() const at examples/audio plugin demo/Builds/MacOSX/…/…/…/…/modules/juce_gui_basics/components/juce_Component.cpp:1052
#8 0x000000010b795a76 in juce::OpenGLContext::CachedImage::updateViewportSize(bool) at examples/audio plugin demo/Builds/MacOSX/…/…/…/…/modules/juce_opengl/opengl/juce_OpenGLContext.cpp:282
#9 0x000000010b79521d in juce::OpenGLContext::CachedImage::renderFrame() at examples/audio plugin demo/Builds/MacOSX/…/…/…/…/modules/juce_opengl/opengl/juce_OpenGLContext.cpp:233
#10 0x000000010b7925cc in juce::OpenGLContext::CachedImage::runJob() at examples/audio plugin demo/Builds/MacOSX/…/…/…/…/modules/juce_opengl/opengl/juce_OpenGLContext.cpp:456
#11 0x000000010b7926d9 in non-virtual thunk to juce::OpenGLContext::CachedImage::runJob() ()
#12 0x000000010b3b2f28 in juce::ThreadPool::runNextJob(juce::ThreadPool::ThreadPoolThread&) at examples/audio plugin demo/Builds/MacOSX/…/…/…/…/modules/juce_core/threads/juce_ThreadPool.cpp:389
#13 0x000000010b405c52 in juce::ThreadPool::ThreadPoolThread::run() at examples/audio plugin demo/Builds/MacOSX/…/…/…/…/modules/juce_core/threads/juce_ThreadPool.cpp:37
#14 0x000000010b3afae0 in juce::Thread::threadEntryPoint() at examples/audio plugin demo/Builds/MacOSX/…/…/…/…/modules/juce_core/threads/juce_Thread.cpp:96
#15 0x000000010b3aff65 in juce::juce_threadEntryPoint(void*) at examples/audio plugin demo/Builds/MacOSX/…/…/…/…/modules/juce_core/threads/juce_Thread.cpp:114
#16 0x000000010b3d220e in ::threadEntryProc(void *) at examples/audio plugin demo/Builds/MacOSX/…/…/…/…/modules/juce_core/native/juce_posix_SharedCode.h:926
#17 0x00000001010ee6b9 in _pthread_body ()
#18 0x00000001010ee565 in _pthread_start ()
#19 0x00000001010edc55 in thread_start ()

juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm: runtime: UI API called from background thread: -[NSView superview] must be used from main thread only

more

#0 0x000000010b6dbe82 in juce::NSViewComponentPeer::getBounds(bool) const at examples/audio plugin demo/Builds/MacOSX/…/…/…/…/modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm:281
#1 0x000000010b6da314 in juce::NSViewComponentPeer::localToGlobal(juce::Point) at examples/audio plugin demo/Builds/MacOSX/…/…/…/…/modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm:306
#2 0x000000010b65b7db in juce::ComponentPeer::localToGlobal(juce::Point) at examples/audio plugin demo/Builds/MacOSX/…/…/…/…/modules/juce_gui_basics/windows/juce_ComponentPeer.cpp:403
#3 0x000000010b65b84f in juce::ComponentPeer::localToGlobal(juce::Rectangle const&) at examples/audio plugin demo/Builds/MacOSX/…/…/…/…/modules/juce_gui_basics/windows/juce_ComponentPeer.cpp:408
#4 0x000000010b57a625 in juce::Rectangle juce::Component::ComponentHelpers::convertToParentSpace<juce::Rectangle >(juce::Component const&, juce::Rectangle) at examples/audio plugin demo/Builds/MacOSX/…/…/…/…/modules/juce_gui_basics/components/juce_Component.cpp:351
#5 0x000000010b5759cd in juce::Rectangle juce::Component::ComponentHelpers::convertCoordinate<juce::Rectangle >(juce::Component const*, juce::Component const*, juce::Rectangle) at examples/audio plugin demo/Builds/MacOSX/…/…/…/…/modules/juce_gui_basics/components/juce_Component.cpp:389
#6 0x000000010b575189 in juce::Component::localAreaToGlobal(juce::Rectangle) const at examples/audio plugin demo/Builds/MacOSX/…/…/…/…/modules/juce_gui_basics/components/juce_Component.cpp:1086
#7 0x000000010b575100 in juce::Component::getScreenBounds() const at examples/audio plugin demo/Builds/MacOSX/…/…/…/…/modules/juce_gui_basics/components/juce_Component.cpp:1052
#8 0x000000010b795a76 in juce::OpenGLContext::CachedImage::updateViewportSize(bool) at examples/audio plugin demo/Builds/MacOSX/…/…/…/…/modules/juce_opengl/opengl/juce_OpenGLContext.cpp:282
#9 0x000000010b79521d in juce::OpenGLContext::CachedImage::renderFrame() at examples/audio plugin demo/Builds/MacOSX/…/…/…/…/modules/juce_opengl/opengl/juce_OpenGLContext.cpp:233
#10 0x000000010b7925cc in juce::OpenGLContext::CachedImage::runJob() at examples/audio plugin demo/Builds/MacOSX/…/…/…/…/modules/juce_opengl/opengl/juce_OpenGLContext.cpp:456
#11 0x000000010b7926d9 in non-virtual thunk to juce::OpenGLContext::CachedImage::runJob() ()
#12 0x000000010b3b2f28 in juce::ThreadPool::runNextJob(juce::ThreadPool::ThreadPoolThread&) at examples/audio plugin demo/Builds/MacOSX/…/…/…/…/modules/juce_core/threads/juce_ThreadPool.cpp:389
#13 0x000000010b405c52 in juce::ThreadPool::ThreadPoolThread::run() at examples/audio plugin demo/Builds/MacOSX/…/…/…/…/modules/juce_core/threads/juce_ThreadPool.cpp:37
#14 0x000000010b3afae0 in juce::Thread::threadEntryPoint() at examples/audio plugin demo/Builds/MacOSX/…/…/…/…/modules/juce_core/threads/juce_Thread.cpp:96
#15 0x000000010b3aff65 in juce::juce_threadEntryPoint(void*) at examples/audio plugin demo/Builds/MacOSX/…/…/…/…/modules/juce_core/threads/juce_Thread.cpp:114
#16 0x000000010b3d220e in ::threadEntryProc(void *) at examples/audio plugin demo/Builds/MacOSX/…/…/…/…/modules/juce_core/native/juce_posix_SharedCode.h:926
#17 0x00000001010ee6b9 in _pthread_body ()
#18 0x00000001010ee565 in _pthread_start ()
#19 0x00000001010edc55 in thread_start ()

juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm: runtime: UI API called from background thread: -[NSView convertRect:toView:] must be used from main thread only

more

#0 0x000000010b6dbf00 in juce::NSViewComponentPeer::getBounds(bool) const at examples/audio plugin demo/Builds/MacOSX/…/…/…/…/modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm:281
#1 0x000000010b6da314 in juce::NSViewComponentPeer::localToGlobal(juce::Point) at examples/audio plugin demo/Builds/MacOSX/…/…/…/…/modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm:306
#2 0x000000010b65b7db in juce::ComponentPeer::localToGlobal(juce::Point) at examples/audio plugin demo/Builds/MacOSX/…/…/…/…/modules/juce_gui_basics/windows/juce_ComponentPeer.cpp:403
#3 0x000000010b65b84f in juce::ComponentPeer::localToGlobal(juce::Rectangle const&) at examples/audio plugin demo/Builds/MacOSX/…/…/…/…/modules/juce_gui_basics/windows/juce_ComponentPeer.cpp:408
#4 0x000000010b57a625 in juce::Rectangle juce::Component::ComponentHelpers::convertToParentSpace<juce::Rectangle >(juce::Component const&, juce::Rectangle) at examples/audio plugin demo/Builds/MacOSX/…/…/…/…/modules/juce_gui_basics/components/juce_Component.cpp:351
#5 0x000000010b5759cd in juce::Rectangle juce::Component::ComponentHelpers::convertCoordinate<juce::Rectangle >(juce::Component const*, juce::Component const*, juce::Rectangle) at examples/audio plugin demo/Builds/MacOSX/…/…/…/…/modules/juce_gui_basics/components/juce_Component.cpp:389
#6 0x000000010b575189 in juce::Component::localAreaToGlobal(juce::Rectangle) const at examples/audio plugin demo/Builds/MacOSX/…/…/…/…/modules/juce_gui_basics/components/juce_Component.cpp:1086
#7 0x000000010b575100 in juce::Component::getScreenBounds() const at examples/audio plugin demo/Builds/MacOSX/…/…/…/…/modules/juce_gui_basics/components/juce_Component.cpp:1052
#8 0x000000010b795a76 in juce::OpenGLContext::CachedImage::updateViewportSize(bool) at examples/audio plugin demo/Builds/MacOSX/…/…/…/…/modules/juce_opengl/opengl/juce_OpenGLContext.cpp:282
#9 0x000000010b79521d in juce::OpenGLContext::CachedImage::renderFrame() at examples/audio plugin demo/Builds/MacOSX/…/…/…/…/modules/juce_opengl/opengl/juce_OpenGLContext.cpp:233
#10 0x000000010b7925cc in juce::OpenGLContext::CachedImage::runJob() at examples/audio plugin demo/Builds/MacOSX/…/…/…/…/modules/juce_opengl/opengl/juce_OpenGLContext.cpp:456
#11 0x000000010b7926d9 in non-virtual thunk to juce::OpenGLContext::CachedImage::runJob() ()
#12 0x000000010b3b2f28 in juce::ThreadPool::runNextJob(juce::ThreadPool::ThreadPoolThread&) at examples/audio plugin demo/Builds/MacOSX/…/…/…/…/modules/juce_core/threads/juce_ThreadPool.cpp:389
#13 0x000000010b405c52 in juce::ThreadPool::ThreadPoolThread::run() at examples/audio plugin demo/Builds/MacOSX/…/…/…/…/modules/juce_core/threads/juce_ThreadPool.cpp:37
#14 0x000000010b3afae0 in juce::Thread::threadEntryPoint() at examples/audio plugin demo/Builds/MacOSX/…/…/…/…/modules/juce_core/threads/juce_Thread.cpp:96
#15 0x000000010b3aff65 in juce::juce_threadEntryPoint(void*) at examples/audio plugin demo/Builds/MacOSX/…/…/…/…/modules/juce_core/threads/juce_Thread.cpp:114
#16 0x000000010b3d220e in ::threadEntryProc(void *) at examples/audio plugin demo/Builds/MacOSX/…/…/…/…/modules/juce_core/native/juce_posix_SharedCode.h:926
#17 0x00000001010ee6b9 in _pthread_body ()
#18 0x00000001010ee565 in _pthread_start ()
#19 0x00000001010edc55 in thread_start ()

To reproduce with the JuceDemoPlugin :
add as member : OpenGLContext openGLContext;
in the constructor : openGLContext.attachTo (*getTopLevelComponent());
in the destructor : openGLContext.detach();

Run the vst (tested in debug, with reaper & ableton)


OpenGLContext In macOS Mojave
#2

Yes, we know, but couldn’t think of a good way to avoid the warning. It’s not a real problem - there’s no race condition because the message manager is locked when these are called, but unfortunately the OSX APIs don’t know that, so give the warning anyway. We’ll certainly try to find a way to silence this if we can though!


#3

when using opengl there is flickering when the plugin is instantiated. The plugin window is created and fully white for a short (but noticeable) time before getting painted.
Is it also a known issue? (I guess it’s related to those UI calls from different threads?)
Any workaround to avoid the flickering?