Textue release assert

opengl

#1

HI, I’m getting this assert in OpenGLTexture::release():

 // If the texture is deleted while the owner context is not active, it's
 // impossible to delete it, so this will be a leak until the context itself
 // is deleted.
  jassert (ownerContext == OpenGLContext::getCurrentContext());      (X) - assert fired

I’m calling the single texture release just like the OpenGLDemo_App. i.e.

 void openGLContextClosing() override
        {
            // When the context is about to close, you must use this callback to delete
            // any GPU resources while the context is still current.
            freeAllContextObjects();

        }
        void freeAllContextObjects()
        {
            shape     .reset();
            shader    .reset();
            attributes.reset();
            uniforms  .reset();
            texture   .release();
        }

Except mine gets to the texture release and assert happens!

I have about 4 opengl contexts over the plug-in, but this is only one with a texture.
*The texture binds OK and renders fine.

The textuer.loadImage function is called in the renderOpenGL function just after a
jassert(OpenGLHelpers::isContextActive());

I think it’s because I have a load of active contexts and it quits with the wrong one context active? I found this out by this never being true at openGLContextClosing()

 if (OpenGLHelpers::isContextActive())
{
		texture.release();
}

#2

Hi. I faced a similar problem. I had not called openGLContext.detach() in the destructor of the MainComponent class. After doing so, it worked fine for me. Hope this helps.


#3

No it still does it for me, the texture is auto released after the detach and the destructor of the component, and it still asserts, this is develop and master branch.
This is in a plug-in with about 4 different contexts. One with a texture.
It states above the assert
" // If the texture is deleted while the owner context is not active, it’s impossible to delete it, so this will be a leak until the context itself is deleted."
But the context is NOT active at that point.