mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-04-28 21:07:59 +03:00
Set Element layout to nil on destroy
This commit is contained in:
parent
9e468e7b73
commit
38bceb653d
2 changed files with 12 additions and 9 deletions
|
@ -189,8 +189,8 @@ namespace LuaUi
|
|||
assert(!mRoot);
|
||||
if (!mRoot)
|
||||
{
|
||||
mRoot = createWidget(mLayout, 0);
|
||||
mLayer = setLayer(mRoot, mLayout);
|
||||
mRoot = createWidget(layout(), 0);
|
||||
mLayer = setLayer(mRoot, layout());
|
||||
updateAttachment();
|
||||
}
|
||||
}
|
||||
|
@ -199,16 +199,16 @@ namespace LuaUi
|
|||
{
|
||||
if (mRoot && mUpdate)
|
||||
{
|
||||
if (mRoot->widget()->getTypeName() != widgetType(mLayout))
|
||||
if (mRoot->widget()->getTypeName() != widgetType(layout()))
|
||||
{
|
||||
destroyWidget(mRoot);
|
||||
mRoot = createWidget(mLayout, 0);
|
||||
mRoot = createWidget(layout(), 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
updateWidget(mRoot, mLayout, 0);
|
||||
updateWidget(mRoot, layout(), 0);
|
||||
}
|
||||
mLayer = setLayer(mRoot, mLayout);
|
||||
mLayer = setLayer(mRoot, layout());
|
||||
updateAttachment();
|
||||
}
|
||||
mUpdate = false;
|
||||
|
@ -216,9 +216,11 @@ namespace LuaUi
|
|||
|
||||
void Element::destroy()
|
||||
{
|
||||
if (mRoot)
|
||||
destroyWidget(mRoot);
|
||||
if (!mRoot)
|
||||
return;
|
||||
destroyWidget(mRoot);
|
||||
mRoot = nullptr;
|
||||
mLayout = sol::make_object(mLayout.lua_state(), sol::nil);
|
||||
sAllElements.erase(this);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue