From ee19b6b5e82ffec423c39994b6894a0973d8138c Mon Sep 17 00:00:00 2001 From: cutealien Date: Tue, 18 Feb 2014 12:02:22 +0000 Subject: [PATCH] Bugfix: IGUIElement::addChild now prevents setting an element as it's own child (fixes for example a crash in the GUI-editor). git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@4694 dfc29bdd-3216-0410-991c-e03cc46cb475 --- changes.txt | 1 + include/IGUIElement.h | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/changes.txt b/changes.txt index 3cb01e0e..6b8894a0 100644 --- a/changes.txt +++ b/changes.txt @@ -1,6 +1,7 @@ -------------------------- Changes in 1.9 (not yet released) +- Bugfix: IGUIElement::addChild now prevents setting an element as it's own child. - Bugfix: getFont for xml-fonts now also works for fonts inside archives (thx @Neirdan for bugreport) - Added function irr::core::mergeFilename - Add ISceneNodeAnimator::setStartTime/getStartTime to allow resetting movement animators. diff --git a/include/IGUIElement.h b/include/IGUIElement.h index 8e293789..f2d79b11 100644 --- a/include/IGUIElement.h +++ b/include/IGUIElement.h @@ -278,9 +278,9 @@ public: //! Adds a GUI element as new child of this element. virtual void addChild(IGUIElement* child) { - addChildToEnd(child); - if (child) + if ( child && child != this ) { + addChildToEnd(child); child->updateAbsolutePosition(); } }