OpenGL Crash - Windows JUCE 8.0.10

Hi everyone,

On our branch that incorporates the JUCE 8.0.10 update, we’re experiencing a nasty crash. Upon disabling the OpenGL renderer, our app immediately crashes. This was not an issue when using the last JUCE update we incorporated into our main branch, which is 8.0.3. I have .dmp files from the crash, but as our code is proprietary I cannot post those on this public forum. I will gladly forward these .dmp files to the JUCE team directly.

One thing to note-we do have small modifications in our JUCE branch. The most pertinent here would be the fact that we manually disabled the Direct2D renderer due to performance issues outlined in a previous post of mine. My next step is to disable these modifications and see if that changes anything; I will report back once I do.

Offending code

void OpenGLTexture::create (const int w, const int h, const void* pixels, GLenum type, bool topLeft)
{
    ownerContext = OpenGLContext::getCurrentContext();
    /* ... */

    if (textureID == 0)
    {
        /* ... */
        /* ownerContext is not checked but is nullptr here - dereference crashes */
        auto glMagFilter = (GLint) (ownerContext->texMagFilter == OpenGLContext::linear ? GL_LINEAR : GL_NEAREST);
        /* ... */
    }
    else
    {
        /* ... */
    }

Stack Trace

juce::OpenGLTexture::create(int, int, const void *, unsigned int, bool)
juce::OpenGLTexture::loadImage(const juce::Image &)
juce::OpenGLRendering::NonShaderContext::~NonShaderContext()
juce::OpenGLRendering::NonShaderContext::~NonShaderContext()
[Inline Frame] std::default_delete<juce::LowLevelGraphicsContext>::operator()(juce::LowLevelGraphicsContext *)
[Inline Frame] std::unique_ptr<juce::LowLevelGraphicsContext,std::default_delete<juce::LowLevelGraphicsContext>>::~unique_ptr()
[Inline Frame] juce::Graphics::~Graphics()
juce::detail::StandardCachedComponentImage::paint(juce::Graphics &)
[Inline Frame] juce::Component::paintWithinParentContext(juce::Graphics &)
juce::Component::paintComponentAndChildren(juce::Graphics &)
[Inline Frame] juce::Component::paintWithinParentContext(juce::Graphics &)
juce::Component::paintComponentAndChildren(juce::Graphics &)
[Inline Frame] juce::Component::paintWithinParentContext(juce::Graphics &)
juce::Component::paintComponentAndChildren(juce::Graphics &)
[Inline Frame] juce::Component::paintWithinParentContext(juce::Graphics &)
juce::Component::paintComponentAndChildren(juce::Graphics &)
[Inline Frame] juce::Component::paintWithinParentContext(juce::Graphics &)
juce::Component::paintComponentAndChildren(juce::Graphics &)
[Inline Frame] juce::Component::paintWithinParentContext(juce::Graphics &)
juce::Component::paintComponentAndChildren(juce::Graphics &)
[Inline Frame] juce::Component::paintEntireComponent(juce::Graphics &, bool)
juce::ComponentPeer::handlePaint(juce::LowLevelGraphicsContext &)
juce::GDIRenderContext::performPaint(HDC__ *, HRGN__ *, int, tagPAINTSTRUCT &)
juce::GDIRenderContext::handlePaintMessage()
[Inline Frame] juce::HWNDComponentPeer::handlePaintMessage()
juce::HWNDComponentPeer::peerWindowProc(HWND__ *, unsigned int, unsigned __int64, __int64)
juce::HWNDComponentPeer::windowProc(HWND__ *, unsigned int, unsigned __int64, __int64)

Update: Undoing all changes related to D2D and rendering in our JUCE branch does not resolve this crash.

Can you compile and reproduce with entirely unmodified JUCE code? The most effective way of pinpointing this issue would be a git bisect, but that could be painful if you have other modifications on your branch.

We’ve also had Direct2D performance improvements since 8.0.3, but that’s an aside here.

I’ll reach out in private about the .dmp file.