Allow changing element root widget type, prevent use after free in script settings

This commit is contained in:
uramer 2022-01-28 21:35:05 +01:00
parent 64df4f54c6
commit a972a54ea9
6 changed files with 73 additions and 26 deletions

View file

@ -26,12 +26,9 @@ namespace LuaUi
allSettings.clear();
}
void attachToWidget(const ScriptSettings& script, MyGUI::Widget* widget)
void attachToWidget(size_t index, MyGUI::Widget* widget)
{
WidgetExtension* root = script.mElement->mRoot;
if (!root)
return;
root->widget()->attachToWidget(widget);
root->updateCoord();
if (0 <= index && index < allSettings.size())
allSettings[index].mElement->attachToWidget(widget);
}
}