mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Don't assert on GL errors if the peer is not valid anymore
This commit is contained in:
parent
7539a993f9
commit
6f94997adb
1 changed files with 54 additions and 0 deletions
|
|
@ -142,6 +142,56 @@ static const char* getGLErrorMessage (const GLenum e) noexcept
|
|||
return "Unknown error";
|
||||
}
|
||||
|
||||
#if JUCE_MAC || JUCE_IOS
|
||||
|
||||
#ifndef JUCE_IOS_MAC_VIEW
|
||||
#if JUCE_IOS
|
||||
#define JUCE_IOS_MAC_VIEW UIView
|
||||
#define JUCE_IOS_MAC_WINDOW UIWindow
|
||||
#else
|
||||
#define JUCE_IOS_MAC_VIEW NSView
|
||||
#define JUCE_IOS_MAC_WINDOW NSWindow
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
static bool checkPeerIsValid (OpenGLContext* context)
|
||||
{
|
||||
jassert (context != nullptr);
|
||||
|
||||
if (context != nullptr)
|
||||
{
|
||||
if (auto* comp = context->getTargetComponent())
|
||||
{
|
||||
if (auto* peer = comp->getPeer())
|
||||
{
|
||||
#if JUCE_MAC || JUCE_IOS
|
||||
if (auto* nsView = (JUCE_IOS_MAC_VIEW*) peer->getNativeHandle())
|
||||
{
|
||||
if (auto* nsWindow = [nsView window])
|
||||
{
|
||||
#if JUCE_MAC
|
||||
return ([nsWindow isVisible]
|
||||
&& (! [nsWindow hidesOnDeactivate] || [NSApp isActive]));
|
||||
#else
|
||||
ignoreUnused (nsWindow);
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#else
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
jassertfalse;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static void checkGLError (const char* file, const int line)
|
||||
{
|
||||
for (;;)
|
||||
|
|
@ -151,6 +201,10 @@ static void checkGLError (const char* file, const int line)
|
|||
if (e == GL_NO_ERROR)
|
||||
break;
|
||||
|
||||
// if the peer is not valid then ignore errors
|
||||
if (! checkPeerIsValid (OpenGLContext::getCurrentContext()))
|
||||
continue;
|
||||
|
||||
DBG ("***** " << getGLErrorMessage (e) << " at " << file << " : " << line);
|
||||
jassertfalse;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue