I think I found a memory leak in juce::HWNDComponentPeer on Windows. I’m using JUCE v5.4.4.
HWNDComponentPeer::createWindow() does this:
dropTarget = new FileDropTarget (*peer);
FYI, dropTarget is declared like so:
FileDropTarget* dropTarget = nullptr;
However, the HWNDComponentPeer destructor cleans it up by doing this:
if (dropTarget != nullptr)
dropTarget->peerIsDeleted = true;
dropTarget = nullptr;
Notice that it calls Release(), which cleans up the underlying IDropTarget COM object, but it doesn’t actually delete the dropTarget object itself.
I was getting the JUCE leak assert when closing my app. Couldn’t figure out what I was doing wrong, so I dug into the JUCE code and found this. Calling delete dropTarget clears it up nicely.