From 6f55cd01cf53108209c299e66c2fe189dc61a344 Mon Sep 17 00:00:00 2001 From: Felix Domke Date: Mon, 19 Dec 2005 00:13:44 +0000 Subject: [PATCH 1/1] widget: don't crash when deallocating in wrong order --- lib/gui/ewidget.cpp | 2 ++ lib/gui/ewidgetdesktop.cpp | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/lib/gui/ewidget.cpp b/lib/gui/ewidget.cpp index 6f7fa91b..3bc6e663 100644 --- a/lib/gui/ewidget.cpp +++ b/lib/gui/ewidget.cpp @@ -140,6 +140,8 @@ void eWidget::hide() while (root && !root->m_desktop) { root = root->m_parent; + if (!root) + return; abspos += root->position(); } assert(root->m_desktop); diff --git a/lib/gui/ewidgetdesktop.cpp b/lib/gui/ewidgetdesktop.cpp index c89cd270..04bc85d9 100644 --- a/lib/gui/ewidgetdesktop.cpp +++ b/lib/gui/ewidgetdesktop.cpp @@ -325,6 +325,12 @@ eWidgetDesktop::eWidgetDesktop(eSize size): m_mainloop(0), m_timer(0) eWidgetDesktop::~eWidgetDesktop() { + /* tell registered root windows that they no longer have a desktop. */ + for (ePtrList::iterator i(m_root.begin()); i != m_root.end(); ) + { + i->m_desktop = 0; + i = m_root.erase(i); + } /* destroy all buffers */ setCompositionMode(-1); } -- 2.30.2