OpenGL - DragAndDropContainer -> mem leak

Hey there,
when creating a openGL context and then going to the next view, a memory leak occurs …
this only seems to be a problem on linux
following two methods are called in the constructor and destructor respectively:

        void LoginView::createOpenGLContext() {
            openGLContext.attachTo(*this);
            if(!openGLContext.isActive())
                openGLContext.makeActive();
        }

    void LoginView::detachOpenGLContext() {
        openGLContext.detach();
    }

Callstack:
kill 0x00007f1ecac16187
juce::LeakedObjectDetectorjuce::DragAndDropContainer::~LeakedObjectDetector juce_LeakedObjectDetector.h:66
juce::DragAndDropContainer::~DragAndDropContainer juce_DragAndDropContainer.cpp:391
juce::DragAndDropContainer::~DragAndDropContainer juce_DragAndDropContainer.cpp:393
juce::LinuxComponentPeer::repaintOpenGLContexts juce_linux_X11_Windowing.cpp:2192
juce::LinuxComponentPeer::handleExposeEvent juce_linux_X11_Windowing.cpp:1980
juce::LinuxComponentPeer::handleWindowMessage juce_linux_X11_Windowing.cpp:1634
juce::WindowingHelpers::windowMessageReceive juce_linux_X11_Windowing.cpp:3453
juce::XWindowSystem::<lambda(int)>::operator()(int) const juce_linux_X11.cpp:217
std::_Function_handler<void(int), juce::XWindowSystem::initialiseXDisplay()::<lambda(int)> >::_M_invoke(const std::_Any_data &, int &&) std_function.h:316
std::function<void (int)>::operator()(int) const std_function.h:706
juce::InternalRunLoop::dispatchPendingEvents juce_linux_Messaging.cpp:171
juce::MessageManager::dispatchNextMessageOnSystemQueue juce_linux_Messaging.cpp:262
juce::MessageManager::runDispatchLoop juce_MessageManager.cpp:128
juce::JUCEApplicationBase::main juce_ApplicationBase.cpp:262
juce::JUCEApplicationBase::main juce_ApplicationBase.cpp:240
main main.cpp:70
__libc_start_main 0x00007f1ecabf8b97
_start 0x000055ba5b0efe1a

any idea on how to solve this issue or is this a juce bug??

any help would be appreciated (:

1 Like

Looks like you’re leaking an object which derives from DragAndDropContainer, I think the OpenGL in the callstack is a red herring. Can you post some more of the code?