LibGUI: Clear previous main widget's window

This commit is contained in:
Tom 2020-07-15 19:49:57 -06:00 committed by Andreas Kling
commit 9844088964
Notes: sideshowbarker 2024-07-19 04:46:19 +09:00

View file

@ -460,8 +460,10 @@ void Window::set_main_widget(Widget* widget)
{
if (m_main_widget == widget)
return;
if (m_main_widget)
if (m_main_widget) {
m_main_widget->set_window(nullptr);
remove_child(*m_main_widget);
}
m_main_widget = widget;
if (m_main_widget) {
add_child(*widget);