mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-12 00:54:20 +02:00
* Guard AudioEngine against null-ptr PlaylistInterfaces.
This commit is contained in:
@@ -140,10 +140,10 @@ AudioEngine::stop( bool sendNotification )
|
|||||||
qDebug() << Q_FUNC_INFO;
|
qDebug() << Q_FUNC_INFO;
|
||||||
|
|
||||||
m_mediaObject->stop();
|
m_mediaObject->stop();
|
||||||
|
|
||||||
if ( m_playlist )
|
if ( m_playlist )
|
||||||
m_playlist->reset();
|
m_playlist->reset();
|
||||||
|
|
||||||
setCurrentTrack( Tomahawk::result_ptr() );
|
setCurrentTrack( Tomahawk::result_ptr() );
|
||||||
emit stopped();
|
emit stopped();
|
||||||
|
|
||||||
@@ -158,7 +158,7 @@ AudioEngine::stop( bool sendNotification )
|
|||||||
stopInfo["message"] = QString( "Tomahawk is stopped." );
|
stopInfo["message"] = QString( "Tomahawk is stopped." );
|
||||||
map[ Tomahawk::InfoSystem::InfoNotifyUser ] = QVariant::fromValue< Tomahawk::InfoSystem::InfoCriteriaHash >( stopInfo );
|
map[ Tomahawk::InfoSystem::InfoNotifyUser ] = QVariant::fromValue< Tomahawk::InfoSystem::InfoCriteriaHash >( stopInfo );
|
||||||
}
|
}
|
||||||
|
|
||||||
Tomahawk::InfoSystem::InfoSystem::instance()->pushInfo( s_aeInfoIdentifier, map );
|
Tomahawk::InfoSystem::InfoSystem::instance()->pushInfo( s_aeInfoIdentifier, map );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -171,7 +171,7 @@ AudioEngine::previous()
|
|||||||
|
|
||||||
if ( !m_playlist )
|
if ( !m_playlist )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ( m_playlist->skipRestrictions() == PlaylistInterface::NoSkip ||
|
if ( m_playlist->skipRestrictions() == PlaylistInterface::NoSkip ||
|
||||||
m_playlist->skipRestrictions() == PlaylistInterface::NoSkipBackwards )
|
m_playlist->skipRestrictions() == PlaylistInterface::NoSkipBackwards )
|
||||||
return;
|
return;
|
||||||
@@ -187,7 +187,7 @@ AudioEngine::next()
|
|||||||
|
|
||||||
if ( !m_playlist )
|
if ( !m_playlist )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ( m_playlist->skipRestrictions() == PlaylistInterface::NoSkip ||
|
if ( m_playlist->skipRestrictions() == PlaylistInterface::NoSkip ||
|
||||||
m_playlist->skipRestrictions() == PlaylistInterface::NoSkipForwards )
|
m_playlist->skipRestrictions() == PlaylistInterface::NoSkipForwards )
|
||||||
return;
|
return;
|
||||||
@@ -209,10 +209,10 @@ AudioEngine::seek( int ms )
|
|||||||
{
|
{
|
||||||
if ( !m_playlist )
|
if ( !m_playlist )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ( m_playlist->seekRestrictions() == PlaylistInterface::NoSeek )
|
if ( m_playlist->seekRestrictions() == PlaylistInterface::NoSeek )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ( isPlaying() || isPaused() )
|
if ( isPlaying() || isPaused() )
|
||||||
{
|
{
|
||||||
qDebug() << Q_FUNC_INFO << ms;
|
qDebug() << Q_FUNC_INFO << ms;
|
||||||
@@ -316,7 +316,7 @@ AudioEngine::loadTrack( const Tomahawk::result_ptr& result )
|
|||||||
trackInfo["artist"] = m_currentTrack->artist()->name();
|
trackInfo["artist"] = m_currentTrack->artist()->name();
|
||||||
trackInfo["album"] = m_currentTrack->album()->name();
|
trackInfo["album"] = m_currentTrack->album()->name();
|
||||||
map[ Tomahawk::InfoSystem::InfoNowPlaying ] = QVariant::fromValue< Tomahawk::InfoSystem::InfoCriteriaHash >( trackInfo );
|
map[ Tomahawk::InfoSystem::InfoNowPlaying ] = QVariant::fromValue< Tomahawk::InfoSystem::InfoCriteriaHash >( trackInfo );
|
||||||
|
|
||||||
if ( TomahawkSettings::instance()->verboseNotifications() )
|
if ( TomahawkSettings::instance()->verboseNotifications() )
|
||||||
{
|
{
|
||||||
Tomahawk::InfoSystem::InfoCriteriaHash playInfo;
|
Tomahawk::InfoSystem::InfoCriteriaHash playInfo;
|
||||||
@@ -326,7 +326,7 @@ AudioEngine::loadTrack( const Tomahawk::result_ptr& result )
|
|||||||
.arg( m_currentTrack->album()->name() );
|
.arg( m_currentTrack->album()->name() );
|
||||||
map[ Tomahawk::InfoSystem::InfoNotifyUser ] = QVariant::fromValue< Tomahawk::InfoSystem::InfoCriteriaHash >( playInfo );
|
map[ Tomahawk::InfoSystem::InfoNotifyUser ] = QVariant::fromValue< Tomahawk::InfoSystem::InfoCriteriaHash >( playInfo );
|
||||||
}
|
}
|
||||||
|
|
||||||
Tomahawk::InfoSystem::InfoSystem::instance()->pushInfo( s_aeInfoIdentifier, map );
|
Tomahawk::InfoSystem::InfoSystem::instance()->pushInfo( s_aeInfoIdentifier, map );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -345,7 +345,7 @@ void
|
|||||||
AudioEngine::loadPreviousTrack()
|
AudioEngine::loadPreviousTrack()
|
||||||
{
|
{
|
||||||
qDebug() << Q_FUNC_INFO;
|
qDebug() << Q_FUNC_INFO;
|
||||||
|
|
||||||
if ( !m_playlist )
|
if ( !m_playlist )
|
||||||
{
|
{
|
||||||
stop();
|
stop();
|
||||||
@@ -492,11 +492,12 @@ AudioEngine::setPlaylist( PlaylistInterface* playlist )
|
|||||||
{
|
{
|
||||||
if ( m_playlist )
|
if ( m_playlist )
|
||||||
m_playlist->reset();
|
m_playlist->reset();
|
||||||
|
|
||||||
m_playlist = playlist;
|
m_playlist = playlist;
|
||||||
|
|
||||||
if ( m_playlist->retryMode() == PlaylistInterface::Retry )
|
if ( m_playlist && m_playlist->retryMode() == PlaylistInterface::Retry )
|
||||||
connect( m_playlist->object(), SIGNAL( nextTrackReady() ), SLOT( playlistNextTrackReady() ) );
|
connect( m_playlist->object(), SIGNAL( nextTrackReady() ), SLOT( playlistNextTrackReady() ) );
|
||||||
|
|
||||||
emit playlistChanged( playlist );
|
emit playlistChanged( playlist );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user