mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
OpenGL: Avoid querying the native view hierarchy from a background thread on macOS
This commit is contained in:
parent
07dec2d369
commit
1ff05d3333
1 changed files with 12 additions and 6 deletions
|
|
@ -117,6 +117,11 @@ public:
|
|||
{
|
||||
if (nativeContext != nullptr)
|
||||
{
|
||||
#if JUCE_MAC
|
||||
cvDisplayLinkWrapper = std::make_unique<CVDisplayLinkWrapper> (*this);
|
||||
cvDisplayLinkWrapper->updateActiveDisplay();
|
||||
#endif
|
||||
|
||||
renderThread = std::make_unique<ThreadPool> (1);
|
||||
resume();
|
||||
}
|
||||
|
|
@ -142,6 +147,10 @@ public:
|
|||
renderThread.reset();
|
||||
}
|
||||
|
||||
#if JUCE_MAC
|
||||
cvDisplayLinkWrapper = nullptr;
|
||||
#endif
|
||||
|
||||
hasInitialised = false;
|
||||
}
|
||||
|
||||
|
|
@ -587,8 +596,7 @@ public:
|
|||
context.renderer->newOpenGLContextCreated();
|
||||
|
||||
#if JUCE_MAC
|
||||
cvDisplayLinkWrapper = std::make_unique<CVDisplayLinkWrapper> (*this);
|
||||
cvDisplayLinkWrapper->updateActiveDisplay();
|
||||
jassert (cvDisplayLinkWrapper != nullptr);
|
||||
nativeContext->setNominalVideoRefreshPeriodS (cvDisplayLinkWrapper->getNominalVideoRefreshPeriodS());
|
||||
#endif
|
||||
|
||||
|
|
@ -597,10 +605,6 @@ public:
|
|||
|
||||
void shutdownOnThread()
|
||||
{
|
||||
#if JUCE_MAC
|
||||
cvDisplayLinkWrapper = nullptr;
|
||||
#endif
|
||||
|
||||
if (context.renderer != nullptr)
|
||||
context.renderer->openGLContextClosing();
|
||||
|
||||
|
|
@ -735,6 +739,8 @@ public:
|
|||
|
||||
NSScreen* getCurrentScreen() const
|
||||
{
|
||||
JUCE_ASSERT_MESSAGE_THREAD;
|
||||
|
||||
if (auto* view = getCurrentView())
|
||||
if (auto* window = [view window])
|
||||
return [window screen];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue