mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-31 01:15:34 +00:00
Don't free ui element's shared_ptr right before destroying it
This commit is contained in:
parent
11ae1a1fcb
commit
e1cbeb0d3b
1 changed files with 6 additions and 5 deletions
|
@ -216,12 +216,13 @@ namespace LuaUi
|
||||||
|
|
||||||
void Element::destroy()
|
void Element::destroy()
|
||||||
{
|
{
|
||||||
|
if (mRoot)
|
||||||
|
{
|
||||||
|
destroyWidget(mRoot);
|
||||||
|
mRoot = nullptr;
|
||||||
|
mLayout = sol::make_object(mLayout.lua_state(), sol::nil);
|
||||||
|
}
|
||||||
sAllElements.erase(this);
|
sAllElements.erase(this);
|
||||||
if (!mRoot)
|
|
||||||
return;
|
|
||||||
destroyWidget(mRoot);
|
|
||||||
mRoot = nullptr;
|
|
||||||
mLayout = sol::make_object(mLayout.lua_state(), sol::nil);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Element::attachToWidget(WidgetExtension* w)
|
void Element::attachToWidget(WidgetExtension* w)
|
||||||
|
|
Loading…
Reference in a new issue