Skip to content

Commit 281ae0b

Browse files
committed
macOS: Render OpenGL frames on ThreadPoolJob instead of directly on the CVDisplayLink thread to avoid a deadlock
1 parent 6688bbf commit 281ae0b

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

modules/juce_opengl/opengl/juce_OpenGLContext.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,10 @@ class OpenGLContext::CachedImage : public CachedComponentImage,
466466

467467
#if JUCE_MAC
468468
if (cvDisplayLinkWrapper != nullptr)
469-
repaintEvent.wait (1000);
469+
{
470+
repaintEvent.wait (-1);
471+
renderFrame();
472+
}
470473
else
471474
#endif
472475
if (! renderFrame())
@@ -683,7 +686,7 @@ class OpenGLContext::CachedImage : public CachedComponentImage,
683686
CVOptionFlags, CVOptionFlags*, void* displayLinkContext)
684687
{
685688
auto* self = (CachedImage*) displayLinkContext;
686-
self->renderFrame();
689+
self->repaintEvent.signal();
687690
return kCVReturnSuccess;
688691
}
689692

0 commit comments

Comments
 (0)