ImageButton & memory leak


#1

Hello

I have a Component with three ImageButton in it.
The images come from an ImageCache.

In my destructor, I put

	removeAllChildren();

but Juce reports a memory leak.
If I delete the buttons in my destructor

	removeAllChildren();
	deleteAndZero(buttonStop);
	deleteAndZero(buttonPlay1x);
	deleteAndZero(buttonPlay2x);

I don’t have any more memory leak.

Why am I forced to delete the buttons ? Isn’t it what removeAllChildren is supposed to do ?

I have another component with a slider and I don’t have to delete it using deleteAndZero, removeAllChildren handles this task.

Can you explain me ?

Thanks!

geoffroy


#2

If you read the help comment for removeAllChildren(), it says:

[code] /** Removes all this component’s children.

    Note that this won't delete them! To do that, use deleteAllChildren() instead.
*/

[/code]

…not sure if could I have explained it any more clearly!


#3

I’m really sorry Jules…

best

geoffroy


#4

No problem!


#5