mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-07-31 11:20:22 +02:00
* Fixed crash bug in AudioEngine: timer-events can arrive after we called stop.
This commit is contained in:
@@ -165,14 +165,17 @@ AudioEngine::stop()
|
|||||||
if ( !m_playlist.isNull() )
|
if ( !m_playlist.isNull() )
|
||||||
m_playlist.data()->reset();
|
m_playlist.data()->reset();
|
||||||
|
|
||||||
setCurrentTrack( Tomahawk::result_ptr() );
|
emit timerPercentage( ( (double)m_timeElapsed / (double)m_currentTrack->duration() ) * 100.0 );
|
||||||
emit stopped();
|
emit stopped();
|
||||||
|
setCurrentTrack( Tomahawk::result_ptr() );
|
||||||
|
|
||||||
Tomahawk::InfoSystem::InfoTypeMap map;
|
Tomahawk::InfoSystem::InfoTypeMap map;
|
||||||
map[ Tomahawk::InfoSystem::InfoNowStopped ] = QVariant();
|
map[ Tomahawk::InfoSystem::InfoNowStopped ] = QVariant();
|
||||||
|
|
||||||
if ( m_waitingOnNewTrack )
|
if ( m_waitingOnNewTrack )
|
||||||
|
{
|
||||||
sendWaitingNotification();
|
sendWaitingNotification();
|
||||||
|
}
|
||||||
else if ( TomahawkSettings::instance()->verboseNotifications() )
|
else if ( TomahawkSettings::instance()->verboseNotifications() )
|
||||||
{
|
{
|
||||||
QVariantMap stopInfo;
|
QVariantMap stopInfo;
|
||||||
@@ -193,6 +196,7 @@ AudioEngine::previous()
|
|||||||
loadPreviousTrack();
|
loadPreviousTrack();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
AudioEngine::next()
|
AudioEngine::next()
|
||||||
{
|
{
|
||||||
@@ -202,6 +206,7 @@ AudioEngine::next()
|
|||||||
loadNextTrack();
|
loadNextTrack();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
AudioEngine::canGoNext()
|
AudioEngine::canGoNext()
|
||||||
{
|
{
|
||||||
@@ -229,6 +234,7 @@ AudioEngine::canGoNext()
|
|||||||
return m_playlist.data()->hasNextItem();
|
return m_playlist.data()->hasNextItem();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
AudioEngine::canGoPrevious()
|
AudioEngine::canGoPrevious()
|
||||||
{
|
{
|
||||||
@@ -242,6 +248,7 @@ AudioEngine::canGoPrevious()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
AudioEngine::canSeek()
|
AudioEngine::canSeek()
|
||||||
{
|
{
|
||||||
@@ -253,6 +260,7 @@ AudioEngine::canSeek()
|
|||||||
return !m_playlist.isNull() && ( m_playlist.data()->seekRestrictions() != PlaylistInterface::NoSeek ) && phononCanSeek;
|
return !m_playlist.isNull() && ( m_playlist.data()->seekRestrictions() != PlaylistInterface::NoSeek ) && phononCanSeek;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
AudioEngine::seek( qint64 ms )
|
AudioEngine::seek( qint64 ms )
|
||||||
{
|
{
|
||||||
@@ -270,12 +278,14 @@ AudioEngine::seek( qint64 ms )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
AudioEngine::seek( int ms )
|
AudioEngine::seek( int ms )
|
||||||
{
|
{
|
||||||
seek( (qint64) ms );
|
seek( (qint64) ms );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
AudioEngine::setVolume( int percentage )
|
AudioEngine::setVolume( int percentage )
|
||||||
{
|
{
|
||||||
@@ -626,22 +636,25 @@ AudioEngine::onStateChanged( Phonon::State newState, Phonon::State oldState )
|
|||||||
void
|
void
|
||||||
AudioEngine::timerTriggered( qint64 time )
|
AudioEngine::timerTriggered( qint64 time )
|
||||||
{
|
{
|
||||||
|
emit timerMilliSeconds( time );
|
||||||
|
|
||||||
if ( m_timeElapsed != time / 1000 )
|
if ( m_timeElapsed != time / 1000 )
|
||||||
{
|
{
|
||||||
m_timeElapsed = time / 1000;
|
m_timeElapsed = time / 1000;
|
||||||
emit timerSeconds( m_timeElapsed );
|
emit timerSeconds( m_timeElapsed );
|
||||||
|
|
||||||
if ( m_currentTrack->duration() == 0 )
|
if ( !m_currentTrack.isNull() )
|
||||||
{
|
{
|
||||||
emit timerPercentage( 0 );
|
if ( m_currentTrack->duration() == 0 )
|
||||||
}
|
{
|
||||||
else
|
emit timerPercentage( 0 );
|
||||||
{
|
}
|
||||||
emit timerPercentage( ( (double)m_timeElapsed / (double)m_currentTrack->duration() ) * 100.0 );
|
else
|
||||||
|
{
|
||||||
|
emit timerPercentage( ( (double)m_timeElapsed / (double)m_currentTrack->duration() ) * 100.0 );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
emit timerMilliSeconds( time );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user