Fix bug in LuaUi::Element::destroy() that sometimes leads to an infinite loop on UI cleanup

simplify_debugging
Petr Mikheev 2 years ago
parent 5f6ca2a6d1
commit c6eed2a6c6

@ -216,12 +216,12 @@ namespace LuaUi
void Element::destroy() void Element::destroy()
{ {
sAllElements.erase(this);
if (!mRoot) if (!mRoot)
return; return;
destroyWidget(mRoot); destroyWidget(mRoot);
mRoot = nullptr; mRoot = nullptr;
mLayout = sol::make_object(mLayout.lua_state(), sol::nil); mLayout = sol::make_object(mLayout.lua_state(), sol::nil);
sAllElements.erase(this);
} }
void Element::attachToWidget(WidgetExtension* w) void Element::attachToWidget(WidgetExtension* w)

Loading…
Cancel
Save