mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-15 10:33:59 +02:00
Workaround crash from SpotifyParser
This commit is contained in:
@@ -842,15 +842,28 @@ SpotifyAccount::resolverMessage( const QString &msgType, const QVariantMap &msg
|
|||||||
const QString qid = msg.value( "qid" ).toString();
|
const QString qid = msg.value( "qid" ).toString();
|
||||||
if ( m_qidToSlotMap.contains( qid ) )
|
if ( m_qidToSlotMap.contains( qid ) )
|
||||||
{
|
{
|
||||||
QObject* receiver = m_qidToSlotMap[ qid ].first;
|
QPointer< QObject > receiver = m_qidToSlotMap[ qid ].first;
|
||||||
QString slot = m_qidToSlotMap[ qid ].second;
|
QString slot = m_qidToSlotMap[ qid ].second;
|
||||||
m_qidToSlotMap.remove( qid );
|
m_qidToSlotMap.remove( qid );
|
||||||
|
|
||||||
|
|
||||||
QVariant extraData;
|
QVariant extraData;
|
||||||
if ( m_qidToExtraData.contains( qid ) )
|
if ( m_qidToExtraData.contains( qid ) )
|
||||||
extraData = m_qidToExtraData.take( qid );
|
extraData = m_qidToExtraData.take( qid );
|
||||||
|
|
||||||
QMetaObject::invokeMethod( receiver, slot.toLatin1(), Q_ARG( QString, msgType ), Q_ARG( QVariantMap, msg ), Q_ARG( QVariant, extraData ) );
|
// FIXME: SpotifyParser is sometimes a dangling pointer, haven't found a real way to reproduce: happens sometimes when dropping a playlist url onto the sidebar
|
||||||
|
//Q_ASSERT( !receiver.isNull() );
|
||||||
|
|
||||||
|
if ( !receiver.isNull() )
|
||||||
|
{
|
||||||
|
QMetaObject::invokeMethod( receiver, slot.toLatin1(), Q_ARG( QString, msgType ), Q_ARG( QVariantMap, msg ), Q_ARG( QVariant, extraData ) );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
JobStatusView::instance()->model()->addJob( new ErrorStatusMessage(
|
||||||
|
tr( "Spotify account could not finish action. Try again." )
|
||||||
|
) );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if ( msgType == "allPlaylists" )
|
else if ( msgType == "allPlaylists" )
|
||||||
{
|
{
|
||||||
|
@@ -172,7 +172,7 @@ private:
|
|||||||
QPointer<ScriptResolver> m_spotifyResolver;
|
QPointer<ScriptResolver> m_spotifyResolver;
|
||||||
QPointer< InfoSystem::SpotifyInfoPlugin > m_infoPlugin;
|
QPointer< InfoSystem::SpotifyInfoPlugin > m_infoPlugin;
|
||||||
|
|
||||||
QMap<QString, QPair<QObject*, QString> > m_qidToSlotMap;
|
QMap<QString, QPair< QPointer< QObject >, QString> > m_qidToSlotMap;
|
||||||
QMap<QString, QVariant > m_qidToExtraData;
|
QMap<QString, QVariant > m_qidToExtraData;
|
||||||
|
|
||||||
// List of synced spotify playlists in config UI
|
// List of synced spotify playlists in config UI
|
||||||
|
Reference in New Issue
Block a user