diff --git a/src/lua/LuaScriptInterface.cpp b/src/lua/LuaScriptInterface.cpp index 589c94562..7dacf9431 100644 --- a/src/lua/LuaScriptInterface.cpp +++ b/src/lua/LuaScriptInterface.cpp @@ -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(); diff --git a/src/lua/LuaWindow.cpp b/src/lua/LuaWindow.cpp index 59b271bc7..dc39fc093 100644 --- a/src/lua/LuaWindow.cpp +++ b/src/lua/LuaWindow.cpp @@ -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;