From e860a9aa809d0053f3903799c833c865e5c80da5 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Thu, 10 Sep 2020 18:44:10 +0200 Subject: [PATCH] LibGUI: Unregister AbstractView from model on destruction It was possible to leave stale view pointers in the model after a view was destroyed while attached to a model. --- Libraries/LibGUI/AbstractView.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Libraries/LibGUI/AbstractView.cpp b/Libraries/LibGUI/AbstractView.cpp index c90167e7c7..9c4aeb4b48 100644 --- a/Libraries/LibGUI/AbstractView.cpp +++ b/Libraries/LibGUI/AbstractView.cpp @@ -44,6 +44,8 @@ AbstractView::AbstractView() AbstractView::~AbstractView() { + if (m_model) + m_model->unregister_view({}, *this); } void AbstractView::set_model(RefPtr model)