Crashes with new OpenGL classes

Hi, with juce tip,
I had some crashes upon closing of my plugin windows. The crashes happened in the drawing thread while drawing to OpenGL while the main thread is in OpenGLContext::CachedImage::~CachedImage() doing stopThread.
Seems like the context somehow got closed while the drawing thread is drawing to it…

I found that adding calls to CGLLockContext and CGLUnlockContext around drawing solves the problem.

not suggesting to actually use this commit it’s somewhat hackish with #ifdefs for mac etc

cheers, Yair

Ok… Interesting. I didn’t know about the CGL lock functions, I’ll have a read about them, thanks!

Thx for the quick fix, awesome responsiveness :slight_smile:
Just one thing - with 10.5 SDK (which is used for ppc targets) these functions require adding an additional include:

#include <OpenGL/OpenGL.h>

I suppose that with later SDKs that include gets there via other includes anyhow or something.

Ah, that dratted 10.5 SDK. Thanks!