We have an OpenGLAppComponent as part of our software that is loaded into a viewport.
It is working without problems with OSX, but on Linux we get an leaked object:
Apparently the leak originates from the linux? message queue, where it tries to trigger the openGL render loop after we already shut down the openGL context.
The openGL component gets deleted without any problems and after that the error occurs.
The leak detector proposes looking for multiple deletions, but we can’t find anything related to that.
okay so I found the solution to our problem, but we don’t know why it works on linux that way…
so basically removing the openGL component triggered removing some cached image files of the openGL context and reset the shared_ptr to the openGL component also tried to remove the resources …
calling it in following order (with the discouraged to call method shutdownOpenGL) solved the issue:
void OpenGLAppComponent::shutdownOpenGL ()
This must be called from your subclass's destructor, to shut down the GL system and stop it calling render() before your class is destroyed.
@matkatmusic I think you don’t understand the point. On OSX you should call shutdownOpenGL() inside the destructor, something like this: ~Destructor() { shutdownOpenGL(); }
If you do the same on Linux you become a leak, I observed this kind of behavior too. On Linux is necessary to call shutdownOpenGL() before you call the destructor.
@matkatmusic This is the point. [Here] you can see the OpenGL App Component tutorial (https://docs.juce.com/master/tutorial_open_gl_application.html)
Under the paragraph “Putting it all together” you are going to find, shutdownOpenGL() is placed at the destructor. As I said before, doing that on Linux caused a leak. The solution was presented over. This should be betted documented.