Linux VST3 plugin with OpenGL crashing when editor is reopened

I have a component like this:

#pragma once
#include <juce_gui_basics/juce_gui_basics.h>
#include <juce_opengl/juce_opengl.h>

using namespace juce;

class OpenGLComponent : public Component, public OpenGLRenderer
        ~OpenGLComponent() override;

        void paint (Graphics&) override {}
        void resized() override {}

        void newOpenGLContextCreated() override;
        void renderOpenGL() override;
        void openGLContextClosing() override;

        OpenGLContext openGLContext;



#include "OpenGLComponent.h"

    openGLContext.setRenderer (this);
    openGLContext.attachTo (*this);


void OpenGLComponent::newOpenGLContextCreated() {}

void OpenGLComponent::renderOpenGL() {}

void OpenGLComponent::openGLContextClosing() {}

and when I use it in a plugin’s editor on Linux, the host crashes the second time I open the editor. Before the crash I get these errors:

ERROR: X returned BadWindow (invalid Window parameter) for operation X_UnmapWindow
ERROR: X returned BadWindow (invalid Window parameter) for operation X_DestroyWindow

I’ve made a repository on github with the simplest example I could write that triggers the crash:

Since the example on JUCE’s website is an application ( I’m wondering if there’s anything I should be doing differently in a VST or if this is really a bug.

Any suggestions?

Thanks for reporting. This has now been fixed on the develop branch with these commits:

1 Like