1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-31 01:15:34 +00:00

Merge branch 'crash_temporary_ui_element' into 'master'

Fix crash #7469

See merge request OpenMW/openmw!3367

(cherry picked from commit 42469c4b54)

e1cbeb0d Don't free ui element's shared_ptr right before destroying it
This commit is contained in:
psi29a 2023-08-21 09:25:30 +00:00
parent 81ab0feb2e
commit a63d7e473e

View file

@ -217,13 +217,14 @@ namespace LuaUi
void Element::destroy() void Element::destroy()
{ {
sAllElements.erase(this); if (mRoot)
if (!mRoot) {
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)
{ {