Memory leaks in plug-ins with the class ComboBox

Hello Jules !

I have detected memory leaks in one plug-in project, which happen only when I use the setSelectedItem function from a ComboBox class, in the constructor of my AudioProcessorEditor. For each ComboBox, it adds 3 16 bit memory leaks ... I am using VS2008 on Windows XP SP3, the last version of Juce, and I'm doing this test with Reaper 32 bits.

Apparently, even if my AudioProcessorEditor creates also Labels objects, the culprit is in the function Label::setText(). If I comment the line "textValue = newText;", the memory leaks diseappears.

I wonder if it is necessary here to add a listener to the Value object textValue (since everything is alright too if I remove the addListener/removeListener)... Since they add so many memory leaks in my software, I have removed that for the moment, before I understand better what is going on here. Memory leaks are scary !

Any idea about that ?

Thanks in advance wink

Those are definitely not leaks caused by any of the classes you mention there.

Are you using Windows? If so, that sounds like the way a couple of Windows message objects can be left on the message queue when the app shuts down. That's nothing to worry about.

Yes I'm using Windows, and the leaks happen when the plug-in shuts down. It's just I didn't have that much leaks with previous versions of JUCE, that's why I was worried. I have just seen 10 leaks + the 2 usual leaks I see all the time, and I wondered if my code was at fault... But if you say that's okay, then that's okay ;)

Well, I'm only guessing. I don't know what else is going on in your app - you could be doing something that's leaking. But if it's not being reported by the juce leak detector then it's probably just a few lost bytes on the message queue.

No it has not been reported by the juce leak detector. I'm just doing something like that in the constructor :

addAndMakeVisible(comboCategory = new ComboBox());    
comboCategory->addItem("Bass", 1);
comboCategory->addItem("Leads", 2);
comboCategory->addItem("Drum Loops", 3);
comboCategory->addItem("Effects", 4);
comboCategory->setSelectedId(1, dontSendNotification);

And the last line is adding two 16 bytes memory leaks... I didn't have these leaks before I update JUCE from 3.0.5 to 3.0.7...

Most likely the combo box triggers an async message, which posts a message to the queue, but the host kills the plugin before the message arrives. Not something that could be fixed, nor is it a problem.

OK thanks Jules wink