From: Felix Domke Date: Mon, 19 Dec 2005 00:13:44 +0000 (+0000) Subject: widget: don't crash when deallocating in wrong order X-Git-Tag: 2.6.0~4672 X-Git-Url: https://git.cweiske.de/enigma2.git/commitdiff_plain/6f55cd01cf53108209c299e66c2fe189dc61a344 widget: don't crash when deallocating in wrong order --- 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); }