From 281ae0b0671b9be56894081febf1b1f704cbc1ed Mon Sep 17 00:00:00 2001 From: ed Date: Tue, 19 May 2020 12:53:09 +0100 Subject: [PATCH] macOS: Render OpenGL frames on ThreadPoolJob instead of directly on the CVDisplayLink thread to avoid a deadlock --- modules/juce_opengl/opengl/juce_OpenGLContext.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/modules/juce_opengl/opengl/juce_OpenGLContext.cpp b/modules/juce_opengl/opengl/juce_OpenGLContext.cpp index 5686dd4d48..de3bec2c16 100644 --- a/modules/juce_opengl/opengl/juce_OpenGLContext.cpp +++ b/modules/juce_opengl/opengl/juce_OpenGLContext.cpp @@ -466,7 +466,10 @@ public: #if JUCE_MAC if (cvDisplayLinkWrapper != nullptr) - repaintEvent.wait (1000); + { + repaintEvent.wait (-1); + renderFrame(); + } else #endif if (! renderFrame()) @@ -683,7 +686,7 @@ public: CVOptionFlags, CVOptionFlags*, void* displayLinkContext) { auto* self = (CachedImage*) displayLinkContext; - self->renderFrame(); + self->repaintEvent.signal(); return kCVReturnSuccess; }