mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-06 14:16:32 +02:00
Don't keep state of a QNetworkReply in a member variable. Get it on-demand.
This commit is contained in:
@@ -44,7 +44,6 @@ md5( const QByteArray& src )
|
|||||||
LastFmPlugin::LastFmPlugin()
|
LastFmPlugin::LastFmPlugin()
|
||||||
: InfoPlugin()
|
: InfoPlugin()
|
||||||
, m_scrobbler( 0 )
|
, m_scrobbler( 0 )
|
||||||
, m_authJob( 0 )
|
|
||||||
{
|
{
|
||||||
m_supportedGetTypes << InfoAlbumCoverArt << InfoArtistImages;
|
m_supportedGetTypes << InfoAlbumCoverArt << InfoArtistImages;
|
||||||
m_supportedPushTypes << InfoSubmitScrobble << InfoSubmitNowPlaying;
|
m_supportedPushTypes << InfoSubmitScrobble << InfoSubmitNowPlaying;
|
||||||
@@ -442,17 +441,18 @@ LastFmPlugin::settingsChanged()
|
|||||||
|
|
||||||
void
|
void
|
||||||
LastFmPlugin::onAuthenticated()
|
LastFmPlugin::onAuthenticated()
|
||||||
{
|
{
|
||||||
qDebug() << Q_FUNC_INFO;
|
qDebug() << Q_FUNC_INFO;
|
||||||
if( !m_authJob )
|
QNetworkReply* authJob = dynamic_cast<QNetworkReply*>( sender() );
|
||||||
|
if( !authJob )
|
||||||
{
|
{
|
||||||
qDebug() << Q_FUNC_INFO << "Help! No longer got a last.fm auth job!";
|
qDebug() << Q_FUNC_INFO << "Help! No longer got a last.fm auth job!";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( m_authJob->error() == QNetworkReply::NoError )
|
if( authJob->error() == QNetworkReply::NoError )
|
||||||
{
|
{
|
||||||
lastfm::XmlQuery lfm = lastfm::XmlQuery( m_authJob->readAll() );
|
lastfm::XmlQuery lfm = lastfm::XmlQuery( authJob->readAll() );
|
||||||
|
|
||||||
if( lfm.children( "error" ).size() > 0 )
|
if( lfm.children( "error" ).size() > 0 )
|
||||||
{
|
{
|
||||||
@@ -473,10 +473,10 @@ LastFmPlugin::onAuthenticated()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
qDebug() << "Got error in Last.fm authentication job:" << m_authJob->errorString();
|
qDebug() << "Got error in Last.fm authentication job:" << authJob->errorString();
|
||||||
}
|
}
|
||||||
|
|
||||||
m_authJob->deleteLater();
|
authJob->deleteLater();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -493,9 +493,9 @@ LastFmPlugin::createScrobbler()
|
|||||||
query[ "method" ] = "auth.getMobileSession";
|
query[ "method" ] = "auth.getMobileSession";
|
||||||
query[ "username" ] = lastfm::ws::Username;
|
query[ "username" ] = lastfm::ws::Username;
|
||||||
query[ "authToken" ] = authToken;
|
query[ "authToken" ] = authToken;
|
||||||
m_authJob = lastfm::ws::post( query );
|
QNetworkReply* authJob = lastfm::ws::post( query );
|
||||||
|
|
||||||
connect( m_authJob, SIGNAL( finished() ), SLOT( onAuthenticated() ) );
|
connect( authJob, SIGNAL( finished() ), SLOT( onAuthenticated() ) );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@@ -75,8 +75,6 @@ private:
|
|||||||
|
|
||||||
QList< QUrl > m_badUrls;
|
QList< QUrl > m_badUrls;
|
||||||
|
|
||||||
QNetworkReply* m_authJob;
|
|
||||||
|
|
||||||
QWeakPointer< QNetworkAccessManager > m_nam;
|
QWeakPointer< QNetworkAccessManager > m_nam;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user