From 04cb9bf3e8e707de734a337abc601ebe27ea2599 Mon Sep 17 00:00:00 2001 From: jules Date: Mon, 29 Dec 2014 12:02:35 +0000 Subject: [PATCH] Added an advisory note about deleteAllChildren() --- modules/juce_gui_basics/components/juce_Component.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/modules/juce_gui_basics/components/juce_Component.h b/modules/juce_gui_basics/components/juce_Component.h index edc1957a3e..8004fd6334 100644 --- a/modules/juce_gui_basics/components/juce_Component.h +++ b/modules/juce_gui_basics/components/juce_Component.h @@ -775,7 +775,13 @@ public: */ void removeAllChildren(); - /** Removes all this component's children, and deletes them. + /** Removes and deletes all of this component's children. + My advice is to avoid this method! It's an old function that is only kept here for + backwards-compatibility with legacy code, and should be viewed with extreme + suspicion by anyone attempting to write modern C++. In almost all cases, it's much + smarter to manage the lifetimes of your child components via modern RAII techniques + such as simply making them member variables, or using ScopedPointer, OwnedArray, etc + to manage their lifetimes appropriately. @see removeAllChildren */ void deleteAllChildren();