The story starts with a nasty bug I ran into in my app yesterday. The symptom: OpenGLContext::CachedImage::initialiseOnThread() getting called with a null CachedImage object. Unfortunately for the purposes of tracking it down, this only happened in release builds.
Finally it looks like I have a symptom that can be reproduced easily in the Juce Demo.
- Download Juce tip
- In juce_OpenGL_osx.h, Replace the implementation of OpenGLContext::NativeContext::makeActive() with the following:
[code] bool makeActive() const noexcept
{
jassert (renderContext != nil);
if ([renderContext view] != view)
[renderContext setView: view];
printf("***** test1: %x \n", (unsigned long)this); // TEMP
ThreadSafeNSOpenGLViewClass::makeActive (view);
printf("***** test2: %x \n", (unsigned long)this); // TEMP
return true;
}
[/code]
- do a Release build of Juce Demo.
- run the demo
- switch to OpenGL rendering.
I see many copies of
***** test1: 726a30
***** test2: 0
Possibly indicating the stack is being trashed in makeActive().