From da92dbfc4b69eb61491543dd3607d186e99fbb23 Mon Sep 17 00:00:00 2001 From: Christian Muehlhaeuser Date: Wed, 27 Oct 2010 05:21:07 +0200 Subject: [PATCH] * Fix crash in TopBar when fading out dudes. --- src/topbar/topbar.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/topbar/topbar.cpp b/src/topbar/topbar.cpp index 71864a2f3..e21514b63 100644 --- a/src/topbar/topbar.cpp +++ b/src/topbar/topbar.cpp @@ -97,8 +97,8 @@ TopBar::fadeInDude( unsigned int i ) { // qDebug() << Q_FUNC_INFO << i; - QLabel * dude = m_dudes.at( i ); - QPropertyAnimation * ani = new QPropertyAnimation( dude, "pos" ); + QLabel* dude = m_dudes.at( i ); + QPropertyAnimation* ani = new QPropertyAnimation( dude, "pos" ); ani->setDuration( 1000 ); ani->setEasingCurve( QEasingCurve::InQuad ); ani->setStartValue( QPoint( -10,0 ) ); @@ -115,8 +115,8 @@ TopBar::fadeOutDude( unsigned int i ) { // qDebug() << Q_FUNC_INFO << i; - QLabel * dude = m_dudes.at( i ); - QPropertyAnimation * ani = new QPropertyAnimation( dude, "pos" ); + QLabel* dude = m_dudes.at( i ); + QPropertyAnimation* ani = new QPropertyAnimation( dude, "pos" ); ani->setDuration( 1000 ); ani->setEasingCurve( QEasingCurve::OutQuad ); ani->setStartValue( dude->pos() ); @@ -152,12 +152,14 @@ TopBar::setNumSources( unsigned int i ) } else { - int k = qMin( (unsigned int)2, m_sources - 1 ); + int k = qMin( (unsigned int)MAXDUDES - 1, m_sources - 1 ); do { - fadeOutDude( k-- ); + fadeOutDude( k ); m_sources--; - } while( m_sources != i ); + } while( k-- > i ); + + m_sources = i; } }