I have got a plugin that uses OpenGL in the GUI. Everything works well as long as there is only one plugin GUI window open.
But when I have a project that has more than one plugin window opened e.g. in Cubase 7 or Reaper, there are sporadic crashes when opening or closing that project.
This happens on different Windows 7 PCs with different graphics cards (different Intel HD graphics and ATI Radeon).
I could reproduce this with a simple modification of the JUCE audio plugin demo, where I have added just one component that uses OpenGL do draw an empty green area. (see attachment)
I tested this with the latest JUCE version.
When using a Cubase project with 2 instances of that plugin where only one GUI is open, I could open and close that project more than 20 times without problems.
When the second GUI is also open, there was always a crash after opening and closing the Cubase project less than 10 times. It seems to happen more often when more than 2 instances are open.
It could happen either when opening or when closing the project. It is always a first chance exception 0xC0000005: Access violation when writing at xxxx.
In the call stack I could see that this is somewhere in the OpenGL graphics driver (e.g. ig4icd32.dll with the Intel HD 3000).
When it happens on project opening, it crashes during the call to wglCreateContext(dc) in the constructor of OpenGLContext::NativeContext.
When it happens on project closing, it crashes during the call to wglDeleteContext(renderContext); in NativeContext::deleteRenderContext()
As this happens with different graphics cards, I assume that it is not a bug of a graphics driver.
Maybe someone can reproduce the problem and find out if this has to be fixed in JUCE or if I am doing something wrong in using the OpenGLContext.
Thanks and Best Regards,