I’m pretty sure this is not a problem with JUCE, but am not being able to solve it from three days.If I manually delete a component I am getting a double drop error, if I did not, the exact node and it’s contents are leaking, how is this possible, they do not share any memory with other components or not being deleted multiple times. I ran it through valgrind but still am as clueless. Appreciate any help.
Invalid free() / delete / delete[] / realloc()
==139810== at 0x484BB6F: operator delete(void*, unsigned long) (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==139810== by 0x1EC526: std::default_delete<ParameterCtrl>::operator()(ParameterCtrl*) const (unique_ptr.h:85)
==139810== by 0x1E9B57: std::unique_ptr<ParameterCtrl, std::default_delete<ParameterCtrl> >::~unique_ptr() (unique_ptr.h:361)
==139810== by 0x1E6A2D: Socket::~Socket() (Socket.h:64)
==139810== by 0x1E6A7D: Socket::~Socket() (Socket.h:64)
==139810== by 0x1EF8F6: juce::ContainerDeletePolicy<Socket>::destroy(Socket*) (juce_ContainerDeletePolicy.h:54)
==139810== by 0x1ECA2A: juce::OwnedArray<Socket, juce::DummyCriticalSection>::deleteAllObjects() (juce_OwnedArray.h:815)
==139810== by 0x1ECC0B: juce::OwnedArray<Socket, juce::DummyCriticalSection>::clearQuick(bool) (juce_OwnedArray.h:120)
==139810== by 0x1EA281: juce::OwnedArray<Socket, juce::DummyCriticalSection>::clear(bool) (juce_OwnedArray.h:109)
==139810== by 0x1E79AC: GraphNode::~GraphNode() (GraphNode.h:187)
==139810== by 0x1E89E9: Oscillator::~Oscillator() (Oscillator.h:61)
==139810== by 0x1E8A09: Oscillator::~Oscillator() (Oscillator.h:61)
==139810== Address 0x69dea60 is 448 bytes inside a block of size 512 alloc'd
==139810== at 0x4849013: operator new(unsigned long) (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==139810== by 0x1E6B95: Socket::addMenuParameterControl() (Socket.h:108)
==139810== by 0x1E842F: Oscillator::Oscillator(int, int) (Oscillator.h:26)
==139810== by 0x1E2AC3: Instrument::GraphPage::AddNodeCallback(int, Instrument::GraphPage*) (Instrument.cpp:358)
==139810== by 0x1EBE2D: juce::ModalCallbackFunction::forComponent<Instrument::GraphPage>(void (*)(int, Instrument::GraphPage*), Instrument::GraphPage*)::{lambda(int)#1}::operator()(int) const (juce_ModalComponentManager.h:281)
==139810== by 0x1F1822: void juce::NullCheckedInvocation::invoke<juce::ModalCallbackFunction::forComponent<Instrument::GraphPage>(void (*)(int, Instrument::GraphPage*), Instrument::GraphPage*)::{lambda(int)#1}, int&>(juce::ModalCallbackFunction::forComponent<Instrument::GraphPage>(void (*)(int, Instrument::GraphPage*), Instrument::GraphPage*)::{lambda(int)#1}&&, int&) (juce_Functional.h:65)
==139810== by 0x1EE8D2: juce::ModalCallbackFunction::create<juce::ModalCallbackFunction::forComponent<Instrument::GraphPage>(void (*)(int, Instrument::GraphPage*), Instrument::GraphPage*)::{lambda(int)#1}>(juce::ModalCallbackFunction::forComponent<Instrument::GraphPage>(void (*)(int, Instrument::GraphPage*), Instrument::GraphPage*)::{lambda(int)#1}&&)::Callable::modalStateFinished(int) (juce_ModalComponentManager.h:179)
==139810== by 0x6BBE70: juce::ModalComponentManager::handleAsyncUpdate() (juce_ModalComponentManager.cpp:210)
==139810== by 0x5753AE: juce::AsyncUpdater::AsyncUpdaterMessage::messageCallback() (juce_AsyncUpdater.cpp:34)
==139810== by 0x577EB0: juce::InternalMessageQueue::InternalMessageQueue()::{lambda(int)#1}::operator()(int) const (juce_Messaging_linux.cpp:42)
==139810== by 0x58B30D: void std::__invoke_impl<void, juce::InternalMessageQueue::InternalMessageQueue()::{lambda(int)#1}&, int>(std::__invoke_other, juce::InternalMessageQueue::InternalMessageQueue()::{lambda(int)#1}&, int&&) (invoke.h:61)
==139810== by 0x587D6A: std::enable_if<is_invocable_r_v<void, juce::InternalMessageQueue::InternalMessageQueue()::{lambda(int)#1}&, int>, void>::type std::__invoke_r<void, juce::InternalMessageQueue::InternalMessageQueue()::{lambda(int)#1}&, int>(juce::InternalMessageQueue::InternalMessageQueue()::{lambda(int)#1}&, int&&) (invoke.h:111)
The allocation and freeing is for the same component here.