diff --git a/components/lua_ui/element.cpp b/components/lua_ui/element.cpp index e54993cfc7..d3bdfc4114 100644 --- a/components/lua_ui/element.cpp +++ b/components/lua_ui/element.cpp @@ -49,14 +49,6 @@ namespace LuaUi MyGUI::Gui::getInstancePtr()->destroyWidget(ext->widget()); } - void destroyChild(WidgetExtension* ext) - { - if (!ext->isRoot()) - destroyWidget(ext); - else - ext->detachFromParent(); - } - void detachElements(WidgetExtension* ext) { auto predicate = [](WidgetExtension* child) { @@ -69,6 +61,17 @@ namespace LuaUi ext->detachTemplateChildrenIf(predicate); } + void destroyChild(WidgetExtension* ext) + { + if (!ext->isRoot()) + { + detachElements(ext); + destroyWidget(ext); + } + else + ext->detachFromParent(); + } + void destroyRoot(WidgetExtension* ext) { detachElements(ext);