From 554cad19cb443928441f0865a548b3625824a294 Mon Sep 17 00:00:00 2001 From: auria Date: Tue, 1 Dec 2009 20:12:13 +0000 Subject: [PATCH] Fixed focus-related crashes git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/irrlicht@4233 178a84e3-b1eb-0310-8ba1-8eac791a3b58 --- src/guiengine/widget.cpp | 15 +++++++++++++++ src/guiengine/widget.hpp | 3 ++- src/guiengine/widgets/dynamic_ribbon_widget.cpp | 6 +++--- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/src/guiengine/widget.cpp b/src/guiengine/widget.cpp index 8c40cfe19..beb723a67 100644 --- a/src/guiengine/widget.cpp +++ b/src/guiengine/widget.cpp @@ -94,6 +94,21 @@ Widget::~Widget() } +void Widget::elementRemoved() +{ + m_element = NULL; + + // If any player focused this widget, unset that focus + for (int n=0; ngetSelectionText(playerID), playerID); } } - //std::cout << "rightpressed (dynamic ribbon)\n"; + //std::cout << "rightpressed (dynamic ribbon) " << m_properties[PROP_ID] << "\n"; assert(m_rows.size() >= 1); if (m_rows[0].m_ribbon_type == RIBBON_TOOLBAR) return EVENT_BLOCK; @@ -353,7 +353,7 @@ EventPropagation DynamicRibbonWidget::rightPressed(const int playerID) } // ----------------------------------------------------------------------------- EventPropagation DynamicRibbonWidget::leftPressed(const int playerID) -{ +{ RibbonWidget* w = getSelectedRibbon(playerID); if (w != NULL) {