Fixed crash when backing to kart selection screen
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@5407 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
@@ -346,6 +346,8 @@ void DynamicRibbonWidget::elementRemoved()
|
||||
m_rows.clearWithoutDeleting();
|
||||
m_left_widget = NULL;
|
||||
m_right_widget = NULL;
|
||||
|
||||
m_hover_listeners.clearAndDeleteAll();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -207,8 +207,12 @@ namespace GUIEngine
|
||||
'updateItemDisplay' to update the display. */
|
||||
void clearItems();
|
||||
|
||||
/** Register a listener to be notified of selection changes within the ribbon.
|
||||
* The ribbon takes ownership of this listener and will delete it. */
|
||||
/**
|
||||
* \brief Register a listener to be notified of selection changes within the ribbon.
|
||||
* \note The ribbon takes ownership of this listener and will delete it.
|
||||
* \note The listener will be deleted upon leaving the screen, so you will likely
|
||||
* want to add a listener in the "init" callback of your screen.
|
||||
*/
|
||||
void registerHoverListener(DynamicRibbonHoverListener* listener);
|
||||
|
||||
/** Called when right key is pressed */
|
||||
|
||||
@@ -698,7 +698,6 @@ public:
|
||||
m_parent->validateKartChoices();
|
||||
}
|
||||
};
|
||||
KartHoverListener* karthoverListener = NULL;
|
||||
|
||||
#if 0
|
||||
#pragma mark -
|
||||
@@ -773,11 +772,10 @@ void KartSelectionScreen::init()
|
||||
DynamicRibbonWidget* w = this->getWidget<DynamicRibbonWidget>("karts");
|
||||
assert( w != NULL );
|
||||
|
||||
if (karthoverListener == NULL)
|
||||
{
|
||||
karthoverListener = new KartHoverListener(this);
|
||||
w->registerHoverListener(karthoverListener);
|
||||
}
|
||||
|
||||
KartHoverListener* karthoverListener = new KartHoverListener(this);
|
||||
w->registerHoverListener(karthoverListener);
|
||||
|
||||
|
||||
// Build kart list (it is built everytime, to account for .g. locking)
|
||||
setKartsFromCurrentGroup();
|
||||
@@ -827,7 +825,6 @@ void KartSelectionScreen::unloaded()
|
||||
{
|
||||
// these pointers are no more valid (have been deleted along other widgets)
|
||||
g_dispatcher = NULL;
|
||||
karthoverListener = NULL;
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user