Fix crash on exit if a Lua component is added to a Lua window

Very similar in nature to the problem fixed by 0fcad65d. Again, it'd be massive help if we didn't destroy the Lua state explicitly in LSI's dtor. But this is not worth refactoring LSI for.
This commit is contained in:
Tamás Bálint Misius 2022-02-11 22:19:42 +01:00
parent 7ab720d847
commit 6ef505ccca
No known key found for this signature in database
GPG Key ID: 5B472A12F6ECA9F2
2 changed files with 3 additions and 0 deletions

View File

@ -4381,6 +4381,7 @@ LuaScriptInterface::~LuaScriptInterface() {
luacon_ci->Window->RemoveComponent(component_and_ref.first->GetComponent());
component_and_ref.second.Clear();
component_and_ref.first->owner_ref = component_and_ref.second;
component_and_ref.first->SetParentWindow(nullptr);
}
luaChangeTypeHandlers.clear();
luaCreateAllowedHandlers.clear();

View File

@ -494,6 +494,7 @@ void LuaWindow::ClearRef(LuaComponent *luaComponent)
{
it->second.Clear();
it->first->owner_ref = it->second;
it->first->SetParentWindow(nullptr);
grabbed_components.erase(it);
}
}
@ -505,6 +506,7 @@ LuaWindow::~LuaWindow()
window->RemoveComponent(component_and_ref.first->GetComponent());
component_and_ref.second.Clear();
component_and_ref.first->owner_ref = component_and_ref.second;
component_and_ref.first->SetParentWindow(nullptr);
}
window->CloseActiveWindow();
delete window;