1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 18:27:35 +00:00

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
parent d87f876946
commit 9844088964

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);