summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Libraries/LibGUI/Window.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/Libraries/LibGUI/Window.cpp b/Libraries/LibGUI/Window.cpp
index b9a1c9e5cc..5c5fff730b 100644
--- a/Libraries/LibGUI/Window.cpp
+++ b/Libraries/LibGUI/Window.cpp
@@ -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);