diff --git a/src/infoplugins/generic/charts/ChartsPlugin.cpp b/src/infoplugins/generic/charts/ChartsPlugin.cpp index d03df7144..c296efc81 100644 --- a/src/infoplugins/generic/charts/ChartsPlugin.cpp +++ b/src/infoplugins/generic/charts/ChartsPlugin.cpp @@ -4,6 +4,7 @@ * Copyright 2011-2012, Hugo Lindström * Copyright 2011, Leo Franchi * Copyright 2010-2011, Jeff Mitchell + * Copyright 2015, Christian Muehlhaeuser * * Tomahawk is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -290,6 +291,7 @@ ChartsPlugin::chartSourcesList() { tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "Got chart sources list"; QNetworkReply* reply = qobject_cast( sender() ); + reply->deleteLater(); if ( reply->error() == QNetworkReply::NoError ) { @@ -432,6 +434,7 @@ ChartsPlugin::chartsList() { tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "Got chart list result"; QNetworkReply* reply = qobject_cast( sender() ); + reply->deleteLater(); if ( reply->error() == QNetworkReply::NoError ) { @@ -623,6 +626,7 @@ ChartsPlugin::chartReturned() { /// Chart request returned something! Woho QNetworkReply* reply = qobject_cast( sender() ); + reply->deleteLater(); QVariantMap returnedData; if ( reply->error() == QNetworkReply::NoError ) diff --git a/src/infoplugins/generic/echonest/EchonestPlugin.cpp b/src/infoplugins/generic/echonest/EchonestPlugin.cpp index a17c4a42b..da9a0fca3 100644 --- a/src/infoplugins/generic/echonest/EchonestPlugin.cpp +++ b/src/infoplugins/generic/echonest/EchonestPlugin.cpp @@ -1,6 +1,6 @@ /* === This file is part of Tomahawk Player - === * - * Copyright 2010-2011, Christian Muehlhaeuser + * Copyright 2010-2015, Christian Muehlhaeuser * Copyright 2010-2011, Jeff Mitchell * * Tomahawk is free software: you can redistribute it and/or modify @@ -181,6 +181,7 @@ void EchonestPlugin::getArtistBiographySlot() { QNetworkReply* reply = qobject_cast( sender() ); + reply->deleteLater(); Echonest::Artist artist = artistFromReply( reply ); Echonest::BiographyList biographies = artist.biographies(); QVariantMap biographyMap; @@ -196,7 +197,6 @@ EchonestPlugin::getArtistBiographySlot() } Tomahawk::InfoSystem::InfoRequestData requestData = reply->property( "requestData" ).value< Tomahawk::InfoSystem::InfoRequestData >(); emit info( requestData, biographyMap ); - reply->deleteLater(); } @@ -204,11 +204,11 @@ void EchonestPlugin::getArtistFamiliaritySlot() { QNetworkReply* reply = qobject_cast( sender() ); + reply->deleteLater(); Echonest::Artist artist = artistFromReply( reply ); qreal familiarity = artist.familiarity(); Tomahawk::InfoSystem::InfoRequestData requestData = reply->property( "requestData" ).value< Tomahawk::InfoSystem::InfoRequestData >(); emit info( requestData, familiarity ); - reply->deleteLater(); } @@ -216,11 +216,11 @@ void EchonestPlugin::getArtistHotttnesssSlot() { QNetworkReply* reply = qobject_cast( sender() ); + reply->deleteLater(); Echonest::Artist artist = artistFromReply( reply ); qreal hotttnesss = artist.hotttnesss(); Tomahawk::InfoSystem::InfoRequestData requestData = reply->property( "requestData" ).value< Tomahawk::InfoSystem::InfoRequestData >(); emit info( requestData, hotttnesss ); - reply->deleteLater(); } @@ -228,6 +228,7 @@ void EchonestPlugin::getArtistTermsSlot() { QNetworkReply* reply = qobject_cast( sender() ); + reply->deleteLater(); Echonest::Artist artist = artistFromReply( reply ); Echonest::TermList terms = artist.terms(); QVariantMap termsMap; @@ -239,7 +240,6 @@ EchonestPlugin::getArtistTermsSlot() } Tomahawk::InfoSystem::InfoRequestData requestData = reply->property( "requestData" ).value< Tomahawk::InfoSystem::InfoRequestData >(); emit info( requestData, termsMap ); - reply->deleteLater(); } @@ -247,6 +247,7 @@ void EchonestPlugin::getMiscTopSlot() { QNetworkReply* reply = qobject_cast( sender() ); + reply->deleteLater(); Echonest::TermList terms = Echonest::Artist::parseTopTerms( reply ); QVariantMap termsMap; Q_FOREACH( const Echonest::Term& term, terms ) { @@ -257,7 +258,6 @@ EchonestPlugin::getMiscTopSlot() } Tomahawk::InfoSystem::InfoRequestData requestData = reply->property( "requestData" ).value< Tomahawk::InfoSystem::InfoRequestData >(); emit info( requestData, termsMap ); - reply->deleteLater(); } diff --git a/src/infoplugins/generic/hypem/HypemPlugin.cpp b/src/infoplugins/generic/hypem/HypemPlugin.cpp index a0538cebe..df3fe5631 100644 --- a/src/infoplugins/generic/hypem/HypemPlugin.cpp +++ b/src/infoplugins/generic/hypem/HypemPlugin.cpp @@ -2,6 +2,7 @@ * * Copyright 2010-2011, Hugo Lindström * Copyright 2010-2011, Jeff Mitchell + * Copyright 2015, Christian Muehlhaeuser * * Tomahawk is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -318,6 +319,8 @@ HypemPlugin::chartReturned() /// Chart request returned something! Woho QNetworkReply* reply = qobject_cast( sender() ); + reply->deleteLater(); + QString url = reply->url().toString(); QVariantMap returnedData; if ( reply->error() == QNetworkReply::NoError ) diff --git a/src/infoplugins/generic/musicbrainz/MusicBrainzPlugin.cpp b/src/infoplugins/generic/musicbrainz/MusicBrainzPlugin.cpp index 92b7b0ab2..603a62e9a 100644 --- a/src/infoplugins/generic/musicbrainz/MusicBrainzPlugin.cpp +++ b/src/infoplugins/generic/musicbrainz/MusicBrainzPlugin.cpp @@ -1,6 +1,6 @@ /* === This file is part of Tomahawk Player - === * - * Copyright 2010-2011, Christian Muehlhaeuser + * Copyright 2010-2015, Christian Muehlhaeuser * Copyright 2010-2011, Jeff Mitchell * * Tomahawk is free software: you can redistribute it and/or modify @@ -155,6 +155,7 @@ MusicBrainzPlugin::gotReleaseGroupsSlot() QNetworkReply* oldReply = qobject_cast( sender() ); if ( !oldReply ) return; //timeout will handle it + oldReply->deleteLater(); QDomDocument doc; doc.setContent( oldReply->readAll() ); @@ -213,6 +214,7 @@ MusicBrainzPlugin::gotReleasesSlot() QNetworkReply* oldReply = qobject_cast( sender() ); if ( !oldReply ) return; //timeout will handle it + oldReply->deleteLater(); QDomDocument doc; doc.setContent( oldReply->readAll() ); @@ -260,6 +262,7 @@ MusicBrainzPlugin::gotRecordingsSlot() QNetworkReply* reply = qobject_cast< QNetworkReply* >( sender() ); if ( !reply ) return; //timeout will handle it + reply->deleteLater(); QDomDocument doc; doc.setContent( reply->readAll() ); diff --git a/src/infoplugins/generic/musixmatch/MusixMatchPlugin.cpp b/src/infoplugins/generic/musixmatch/MusixMatchPlugin.cpp index 636556828..1b0c00a0e 100644 --- a/src/infoplugins/generic/musixmatch/MusixMatchPlugin.cpp +++ b/src/infoplugins/generic/musixmatch/MusixMatchPlugin.cpp @@ -1,6 +1,6 @@ /* === This file is part of Tomahawk Player - === * - * Copyright 2010-2011, Christian Muehlhaeuser + * Copyright 2010-2015, Christian Muehlhaeuser * Copyright 2010-2011, Jeff Mitchell * * Tomahawk is free software: you can redistribute it and/or modify @@ -112,6 +112,7 @@ MusixMatchPlugin::trackSearchSlot() QNetworkReply* oldReply = qobject_cast( sender() ); if ( !oldReply ) return; //timeout will handle it + oldReply->deleteLater(); QDomDocument doc; doc.setContent(oldReply->readAll()); @@ -142,6 +143,7 @@ MusixMatchPlugin::trackLyricsSlot() QNetworkReply* reply = qobject_cast< QNetworkReply* >( sender() ); if ( !reply ) return; //timeout will handle it + reply->deleteLater(); QDomDocument doc; doc.setContent( reply->readAll() ); diff --git a/src/infoplugins/generic/newreleases/NewReleasesPlugin.cpp b/src/infoplugins/generic/newreleases/NewReleasesPlugin.cpp index 47b15f568..5ed15e578 100644 --- a/src/infoplugins/generic/newreleases/NewReleasesPlugin.cpp +++ b/src/infoplugins/generic/newreleases/NewReleasesPlugin.cpp @@ -4,6 +4,7 @@ * Copyright 2011-2012, Hugo Lindström * Copyright 2011, Leo Franchi * Copyright 2010-2011, Jeff Mitchell + * Copyright 2015, Christian Muehlhaeuser * * Tomahawk is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -295,11 +296,13 @@ NewReleasesPlugin::notInCacheSlot( InfoStringHash criteria, InfoRequestData requ } } + void NewReleasesPlugin::nrSourcesList() { tDebug ( LOGVERBOSE ) << Q_FUNC_INFO << "Got newreleases sources list"; QNetworkReply* reply = qobject_cast( sender() ); + reply->deleteLater(); if ( reply->error() == QNetworkReply::NoError ) { @@ -434,6 +437,7 @@ NewReleasesPlugin::nrList() { tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "Got newreleases list result"; QNetworkReply* reply = qobject_cast( sender() ); + reply->deleteLater(); if ( reply->error() == QNetworkReply::NoError ) { @@ -658,13 +662,15 @@ NewReleasesPlugin::getMaxAge( const qlonglong expires ) const return 0; } + void NewReleasesPlugin::nrReturned() { /// Chart request returned something! Woho QNetworkReply* reply = qobject_cast( sender() ); - QVariantMap returnedData; + reply->deleteLater(); + QVariantMap returnedData; if ( reply->error() == QNetworkReply::NoError ) { bool ok; diff --git a/src/infoplugins/generic/rovi/RoviPlugin.cpp b/src/infoplugins/generic/rovi/RoviPlugin.cpp index 652835ef4..4bae49fb0 100644 --- a/src/infoplugins/generic/rovi/RoviPlugin.cpp +++ b/src/infoplugins/generic/rovi/RoviPlugin.cpp @@ -2,6 +2,7 @@ * * Copyright 2010-2011, Leo Franchi * Copyright 2010-2011, Jeff Mitchell + * Copyright 2015, Christian Muehlhaeuser * * Tomahawk is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -121,6 +122,7 @@ RoviPlugin::albumLookupFinished() { QNetworkReply* reply = qobject_cast( sender() ); Q_ASSERT( reply ); + reply->deleteLater(); if ( reply->error() != QNetworkReply::NoError ) return; diff --git a/src/infoplugins/generic/spotify/SpotifyPlugin.cpp b/src/infoplugins/generic/spotify/SpotifyPlugin.cpp index 3cc0aa879..1d29148dd 100644 --- a/src/infoplugins/generic/spotify/SpotifyPlugin.cpp +++ b/src/infoplugins/generic/spotify/SpotifyPlugin.cpp @@ -2,6 +2,7 @@ * * Copyright 2010-2011, Hugo Lindström * Copyright 2010-2011, Jeff Mitchell + * Copyright 2015, Christian Muehlhaeuser * * Tomahawk is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -196,6 +197,7 @@ SpotifyPlugin::chartTypes() /// Get possible chart type for specificSpotifyPlugin: InfoChart types returned chart source tDebug() << Q_FUNC_INFO << "Got spotifychart type result"; QNetworkReply* reply = qobject_cast( sender() ); + reply->deleteLater(); if ( reply->error() == QNetworkReply::NoError ) { @@ -284,6 +286,7 @@ SpotifyPlugin::chartReturned() { /// Chart request returned something! Woho QNetworkReply* reply = qobject_cast( sender() ); + reply->deleteLater(); QString url = reply->url().toString(); QVariantMap returnedData; if ( reply->error() == QNetworkReply::NoError ) diff --git a/src/libtomahawk/AtticaManager.cpp b/src/libtomahawk/AtticaManager.cpp index 23144163c..63f21b1ff 100644 --- a/src/libtomahawk/AtticaManager.cpp +++ b/src/libtomahawk/AtticaManager.cpp @@ -1,6 +1,7 @@ /* === This file is part of Tomahawk Player - === * * Copyright 2010-2011, Leo Franchi + * Copyright 2015, Christian Muehlhaeuser * * Tomahawk is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -461,6 +462,7 @@ AtticaManager::resolverIconFetched() { QNetworkReply* reply = qobject_cast< QNetworkReply* >( sender() ); Q_ASSERT( reply ); + reply->deleteLater(); const QString resolverId = reply->property( "resolverId" ).toString(); @@ -631,6 +633,7 @@ AtticaManager::payloadFetched() { QNetworkReply* reply = qobject_cast< QNetworkReply* >( sender() ); Q_ASSERT( reply ); + reply->deleteLater(); bool installedSuccessfully = false; const QString resolverId = reply->property( "resolverId" ).toString(); diff --git a/src/libtomahawk/EchonestCatalogSynchronizer.cpp b/src/libtomahawk/EchonestCatalogSynchronizer.cpp index 5d030c75c..afd015370 100644 --- a/src/libtomahawk/EchonestCatalogSynchronizer.cpp +++ b/src/libtomahawk/EchonestCatalogSynchronizer.cpp @@ -1,6 +1,7 @@ /* === This file is part of Tomahawk Player - === * * Copyright 2010-2011, Leo Franchi + * Copyright 2015, Christian Muehlhaeuser * * Tomahawk is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -125,6 +126,7 @@ EchonestCatalogSynchronizer::catalogDeleted() { QNetworkReply* r = qobject_cast< QNetworkReply* >( sender() ); Q_ASSERT( r ); + r->deleteLater(); QString toDel = QString( "collection/%1Catalog" ).arg( r->property( "type" ).toString() ); @@ -158,6 +160,7 @@ EchonestCatalogSynchronizer::songCreateFinished() { QNetworkReply* r = qobject_cast< QNetworkReply* >( sender() ); Q_ASSERT( r ); + r->deleteLater(); tDebug() << "Finished creating song catalog, updating data now!!"; try @@ -192,6 +195,7 @@ EchonestCatalogSynchronizer::artistCreateFinished() { QNetworkReply* r = qobject_cast< QNetworkReply* >( sender() ); Q_ASSERT( r ); + r->deleteLater(); // We don't support artist catalogs at the moment return; @@ -275,6 +279,7 @@ EchonestCatalogSynchronizer::songUpdateFinished() { QNetworkReply* r = qobject_cast< QNetworkReply* >( sender() ); Q_ASSERT( r ); + r->deleteLater(); try { @@ -294,6 +299,7 @@ EchonestCatalogSynchronizer::checkTicket() { QNetworkReply* r = qobject_cast< QNetworkReply* >( sender() ); Q_ASSERT( r ); + r->deleteLater(); try { diff --git a/src/libtomahawk/accounts/lastfm/LastFmInfoPlugin.cpp b/src/libtomahawk/accounts/lastfm/LastFmInfoPlugin.cpp index d1c897dec..71771ad6b 100644 --- a/src/libtomahawk/accounts/lastfm/LastFmInfoPlugin.cpp +++ b/src/libtomahawk/accounts/lastfm/LastFmInfoPlugin.cpp @@ -555,6 +555,7 @@ void LastFmInfoPlugin::similarArtistsReturned() { QNetworkReply* reply = qobject_cast( sender() ); + reply->deleteLater(); QMap< int, QString > similarArtists = lastfm::Artist::getSimilar( reply ); @@ -596,6 +597,7 @@ void LastFmInfoPlugin::similarTracksReturned() { QNetworkReply* reply = qobject_cast( sender() ); + reply->deleteLater(); QMap< int, QPair< QString, QString > > similarTracks = lastfm::Track::getSimilar( reply ); @@ -648,6 +650,7 @@ void LastFmInfoPlugin::chartReturned() { QNetworkReply* reply = qobject_cast( sender() ); + reply->deleteLater(); QVariantMap returnedData; const QRegExp tracks_rx( "chart\\.\\S+tracks\\S*", Qt::CaseInsensitive ); @@ -694,6 +697,7 @@ void LastFmInfoPlugin::topTracksReturned() { QNetworkReply* reply = qobject_cast( sender() ); + reply->deleteLater(); QStringList topTracks = lastfm::Artist::getTopTracks( reply ); topTracks.removeDuplicates(); @@ -716,6 +720,7 @@ void LastFmInfoPlugin::artistInfoReturned() { QNetworkReply* reply = qobject_cast( sender() ); + reply->deleteLater(); Tomahawk::InfoSystem::InfoRequestData requestData = reply->property( "requestData" ).value< Tomahawk::InfoSystem::InfoRequestData >(); if ( requestData.type == Tomahawk::InfoSystem::InfoArtistBiography ) @@ -776,6 +781,7 @@ void LastFmInfoPlugin::albumInfoReturned() { QNetworkReply* reply = qobject_cast( sender() ); + reply->deleteLater(); Tomahawk::InfoSystem::InfoRequestData requestData = reply->property( "requestData" ).value< Tomahawk::InfoSystem::InfoRequestData >(); if ( requestData.type == Tomahawk::InfoSystem::InfoAlbumCoverArt ) @@ -802,6 +808,7 @@ void LastFmInfoPlugin::coverArtReturned() { QNetworkReply* reply = qobject_cast( sender() ); + reply->deleteLater(); QUrl redir = reply->attribute( QNetworkRequest::RedirectionTargetAttribute ).toUrl(); if ( redir.isEmpty() ) { @@ -841,8 +848,6 @@ LastFmInfoPlugin::coverArtReturned() newReply->setProperty( "requestData", reply->property( "requestData" ) ); connect( newReply, SIGNAL( finished() ), SLOT( coverArtReturned() ) ); } - - reply->deleteLater(); } @@ -850,6 +855,7 @@ void LastFmInfoPlugin::artistImagesReturned() { QNetworkReply* reply = qobject_cast( sender() ); + reply->deleteLater(); QUrl redir = reply->attribute( QNetworkRequest::RedirectionTargetAttribute ).toUrl(); if ( redir.isEmpty() ) { @@ -893,8 +899,6 @@ LastFmInfoPlugin::artistImagesReturned() newReply->setProperty( "requestData", reply->property( "requestData" ) ); connect( newReply, SIGNAL( finished() ), SLOT( artistImagesReturned() ) ); } - - reply->deleteLater(); } @@ -939,7 +943,8 @@ void LastFmInfoPlugin::onAuthenticated() { QNetworkReply* authJob = dynamic_cast( sender() ); - if ( !authJob || m_account.isNull() ) + authJob->deleteLater(); + if ( m_account.isNull() ) { tLog() << Q_FUNC_INFO << "Help! No longer got a last.fm auth job!"; return; @@ -969,8 +974,6 @@ LastFmInfoPlugin::onAuthenticated() tLog() << Q_FUNC_INFO << error.simplified(); } - - authJob->deleteLater(); } diff --git a/src/libtomahawk/playlist/dynamic/echonest/EchonestGenerator.cpp b/src/libtomahawk/playlist/dynamic/echonest/EchonestGenerator.cpp index b8399661d..f214e16ff 100644 --- a/src/libtomahawk/playlist/dynamic/echonest/EchonestGenerator.cpp +++ b/src/libtomahawk/playlist/dynamic/echonest/EchonestGenerator.cpp @@ -1,6 +1,7 @@ /* === This file is part of Tomahawk Player - === * * Copyright 2010-2011, Leo Franchi + * Copyright 2015, Christian Muehlhaeuser * * Tomahawk is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -293,6 +294,7 @@ EchonestGenerator::staticFinished() Q_ASSERT( qobject_cast< QNetworkReply* >( sender() ) ); QNetworkReply* reply = qobject_cast< QNetworkReply* >( sender() ); + reply->deleteLater(); Echonest::SongList songs; try { @@ -361,6 +363,7 @@ void EchonestGenerator::songLookupFinished() { QNetworkReply* r = qobject_cast< QNetworkReply* >( sender() ); + r->deleteLater(); if( !m_waiting.contains( r ) ) // another generate/start was begun meanwhile, we're out of date return; @@ -399,6 +402,7 @@ EchonestGenerator::dynamicStarted() Q_ASSERT( sender() ); Q_ASSERT( qobject_cast< QNetworkReply* >( sender() ) ); QNetworkReply* reply = qobject_cast< QNetworkReply* >( sender() ); + reply->deleteLater(); try { @@ -417,6 +421,7 @@ EchonestGenerator::dynamicFetched() Q_ASSERT( sender() ); Q_ASSERT( qobject_cast< QNetworkReply* >( sender() ) ); QNetworkReply* reply = qobject_cast< QNetworkReply* >( sender() ); + reply->deleteLater(); try { @@ -731,6 +736,7 @@ EchonestGenerator::moodsReceived() { QNetworkReply* r = qobject_cast< QNetworkReply* >( sender() ); Q_ASSERT( r ); + r->deleteLater(); try { @@ -760,6 +766,7 @@ EchonestGenerator::stylesReceived() { QNetworkReply* r = qobject_cast< QNetworkReply* >( sender() ); Q_ASSERT( r ); + r->deleteLater(); try { @@ -787,6 +794,7 @@ EchonestGenerator::genresReceived() { QNetworkReply* r = qobject_cast< QNetworkReply* >( sender() ); Q_ASSERT( r ); + r->deleteLater(); try { diff --git a/src/libtomahawk/resolvers/ScriptInfoPlugin.cpp b/src/libtomahawk/resolvers/ScriptInfoPlugin.cpp index db767dd7c..3c2c26895 100644 --- a/src/libtomahawk/resolvers/ScriptInfoPlugin.cpp +++ b/src/libtomahawk/resolvers/ScriptInfoPlugin.cpp @@ -1,6 +1,7 @@ /* === This file is part of Tomahawk Player - === * - * Copyright 2014, Dominik Schmidt + * Copyright 2014, Dominik Schmidt + * Copyright 2015, Christian Muehlhaeuser * * Tomahawk is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/libtomahawk/utils/GroovesharkParser.cpp b/src/libtomahawk/utils/GroovesharkParser.cpp index 03ce3ec4b..f62a7f902 100644 --- a/src/libtomahawk/utils/GroovesharkParser.cpp +++ b/src/libtomahawk/utils/GroovesharkParser.cpp @@ -3,6 +3,7 @@ * Copyright 2010-2011, Leo Franchi * Copyright 2010-2011, Hugo Lindström * Copyright 2010-2012, Stefan Derkits + * Copyright 2015, Christian Muehlhaeuser * * Tomahawk is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -163,9 +164,9 @@ GroovesharkParser::trackPageFetchFinished() { NetworkReply* r = qobject_cast< NetworkReply* >( sender() ); Q_ASSERT( r ); + r->deleteLater(); m_queries.remove( r ); - r->deleteLater(); QWebPage page; page.settings()->setAttribute( QWebSettings::JavascriptEnabled, false ); @@ -195,9 +196,9 @@ GroovesharkParser::groovesharkLookupFinished() { NetworkReply* r = qobject_cast< NetworkReply* >( sender() ); Q_ASSERT( r ); + r->deleteLater(); m_queries.remove( r ); - r->deleteLater(); if ( r->reply()->error() == QNetworkReply::NoError ) { diff --git a/src/libtomahawk/utils/ItunesParser.cpp b/src/libtomahawk/utils/ItunesParser.cpp index 31b4d94bb..1c09d530b 100644 --- a/src/libtomahawk/utils/ItunesParser.cpp +++ b/src/libtomahawk/utils/ItunesParser.cpp @@ -3,6 +3,7 @@ * Written by Hugo Lindström * But based on Leo Franchi's work from spotifyParser * Copyright 2010-2011, Leo Franchi + * Copyright 2010-2014, Christian Muehlhaeuser * * Tomahawk is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -128,8 +129,8 @@ ItunesParser::itunesResponseLookupFinished() { NetworkReply* r = qobject_cast< NetworkReply* >( sender() ); Q_ASSERT( r ); - m_queries.remove( r ); r->deleteLater(); + m_queries.remove( r ); if ( r->reply()->error() == QNetworkReply::NoError ) { diff --git a/src/libtomahawk/utils/JspfLoader.cpp b/src/libtomahawk/utils/JspfLoader.cpp index 8b909f6d3..d4583fa4e 100644 --- a/src/libtomahawk/utils/JspfLoader.cpp +++ b/src/libtomahawk/utils/JspfLoader.cpp @@ -1,6 +1,7 @@ /* === This file is part of Tomahawk Player - === * * Copyright 2010-2011, Leo Franchi * * Tomahawk is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -99,13 +100,13 @@ void JSPFLoader::networkLoadFinished() { NetworkReply* r = qobject_cast( sender() ); + r->deleteLater(); + if ( r->reply()->error() == QNetworkReply::NoError ) { m_body = r->reply()->readAll(); gotBody(); } - - r->deleteLater(); } diff --git a/src/libtomahawk/utils/ShortenedLinkParser.cpp b/src/libtomahawk/utils/ShortenedLinkParser.cpp index 4f048ae94..e66e83f5a 100644 --- a/src/libtomahawk/utils/ShortenedLinkParser.cpp +++ b/src/libtomahawk/utils/ShortenedLinkParser.cpp @@ -1,7 +1,7 @@ /* === This file is part of Tomahawk Player - === * * Copyright 2010-2011, Leo Franchi - * Copyright 2010-2011, Christian Muehlhaeuser + * Copyright 2010-2015, Christian Muehlhaeuser * * Tomahawk is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -98,6 +98,7 @@ ShortenedLinkParser::lookupFinished( const QUrl& url ) { NetworkReply* r = qobject_cast< NetworkReply* >( sender() ); Q_ASSERT( r ); + r->deleteLater(); if ( r->reply()->error() != QNetworkReply::NoError ) JobStatusView::instance()->model()->addJob( new ErrorStatusMessage( tr( "Network error parsing shortened link!" ) ) ); @@ -105,7 +106,6 @@ ShortenedLinkParser::lookupFinished( const QUrl& url ) tLog( LOGVERBOSE ) << Q_FUNC_INFO << "Got an un-shortened url:" << r->reply()->url().toString(); m_links << url.toString(); m_queries.remove( r ); - r->deleteLater(); checkFinished(); } diff --git a/src/libtomahawk/utils/SpotifyParser.cpp b/src/libtomahawk/utils/SpotifyParser.cpp index a5d863c5f..011cbad85 100644 --- a/src/libtomahawk/utils/SpotifyParser.cpp +++ b/src/libtomahawk/utils/SpotifyParser.cpp @@ -2,6 +2,7 @@ * * Copyright 2010-2011, Leo Franchi * Copyright 2010-2011, Hugo Lindström + * Copyright 2015, Christian Muehlhaeuser * * Tomahawk is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -220,9 +221,8 @@ SpotifyParser::spotifyBrowseFinished() { NetworkReply* r = qobject_cast< NetworkReply* >( sender() ); Q_ASSERT( r ); - - m_queries.remove( r ); r->deleteLater(); + m_queries.remove( r ); if ( r->reply()->error() == QNetworkReply::NoError ) { @@ -293,8 +293,8 @@ SpotifyParser::spotifyTrackLookupFinished() { NetworkReply* r = qobject_cast< NetworkReply* >( sender() ); Q_ASSERT( r ); - m_queries.remove( r ); r->deleteLater(); + m_queries.remove( r ); if ( r->reply()->error() == QNetworkReply::NoError ) { diff --git a/src/libtomahawk/utils/XspfLoader.cpp b/src/libtomahawk/utils/XspfLoader.cpp index b9c939728..25f3b8703 100644 --- a/src/libtomahawk/utils/XspfLoader.cpp +++ b/src/libtomahawk/utils/XspfLoader.cpp @@ -1,6 +1,6 @@ /* === This file is part of Tomahawk Player - === * - * Copyright 2010-2011, Christian Muehlhaeuser + * Copyright 2010-2015, Christian Muehlhaeuser * Copyright 2011-2012, Leo Franchi * Copyright 2010-2011, Jeff Mitchell * @@ -183,13 +183,13 @@ void XSPFLoader::networkLoadFinished() { NetworkReply* r = qobject_cast( sender() ); + r->deleteLater(); + if ( r->reply()->error() == QNetworkReply::NoError ) { m_body = r->reply()->readAll(); gotBody(); } - - r->deleteLater(); } diff --git a/src/tomahawk/TomahawkApp.cpp b/src/tomahawk/TomahawkApp.cpp index 75998f21c..669be299c 100644 --- a/src/tomahawk/TomahawkApp.cpp +++ b/src/tomahawk/TomahawkApp.cpp @@ -789,6 +789,7 @@ TomahawkApp::spotifyApiCheckFinished() { QNetworkReply* reply = qobject_cast< QNetworkReply* >( sender() ); Q_ASSERT( reply ); + reply->deleteLater(); DropJob::setCanParseSpotifyPlaylists( !reply->error() ); }