From: Thomas Geymayer Date: Fri, 7 Jun 2013 14:23:44 +0000 (+0200) Subject: CanvasGroup: Fix handling z-index while moving child to front. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=60a81dfbd86338646e70739e34bca369d9c6753a;p=simgear.git CanvasGroup: Fix handling z-index while moving child to front. --- diff --git a/simgear/canvas/elements/CanvasGroup.cxx b/simgear/canvas/elements/CanvasGroup.cxx index b290fb0e..3d29c77e 100644 --- a/simgear/canvas/elements/CanvasGroup.cxx +++ b/simgear/canvas/elements/CanvasGroup.cxx @@ -301,11 +301,13 @@ namespace canvas } else { - ChildList::iterator prev = child; - while( prev != _children.begin() - && (--prev)->first->getIntValue("z-index", 0) > z_index) + ChildList::iterator prev = child, + check = child; + while( check != _children.begin() + && (--check)->first->getIntValue("z-index", 0) > z_index ) { --index_new; + --prev; } if( index == index_new )