From c6eed2a6c6f4f528e28a379f0407f1d10a319d45 Mon Sep 17 00:00:00 2001 From: Petr Mikheev Date: Sat, 20 May 2023 02:30:12 +0200 Subject: [PATCH] Fix bug in LuaUi::Element::destroy() that sometimes leads to an infinite loop on UI cleanup --- components/lua_ui/element.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/lua_ui/element.cpp b/components/lua_ui/element.cpp index 6f06f55cd8..bd76ba3207 100644 --- a/components/lua_ui/element.cpp +++ b/components/lua_ui/element.cpp @@ -216,12 +216,12 @@ namespace LuaUi void Element::destroy() { + sAllElements.erase(this); if (!mRoot) return; destroyWidget(mRoot); mRoot = nullptr; mLayout = sol::make_object(mLayout.lua_state(), sol::nil); - sAllElements.erase(this); } void Element::attachToWidget(WidgetExtension* w)