Crashes with new OpenGL classes


#1

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.

see https://github.com/yairchu/JUCE/commit/a4fbb73dca770e5738811024cad865b42d307837
not suggesting to actually use this commit it’s somewhat hackish with #ifdefs for mac etc

cheers, Yair


#2

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


#3

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.


#4

Ah, that dratted 10.5 SDK. Thanks!