1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-07-31 19:30:21 +02:00

tomahawk: pass the NetworkReply directly to stop segfaulting

* this now means the Google Music resolver works :)
This commit is contained in:
Lalit Maganti
2014-05-24 18:50:07 +01:00
parent 42b5153a13
commit 6e63bc72a7
2 changed files with 4 additions and 5 deletions

View File

@@ -611,14 +611,12 @@ JSResolverHelper::returnStreamUrl( const QString& streamUrl, const QMap<QString,
tDebug() << "Creating a QNetowrkReply with url:" << req.url().toString();
NetworkReply* reply = new NetworkReply( Tomahawk::Utils::nam()->get( req ) );
NewClosure( QSharedPointer<NetworkReply>( reply ) , SIGNAL( finalUrlReached() ), this, SLOT( gotStreamUrl( boost::function< void( QSharedPointer< QIODevice >& ) > ) ), callback );
NewClosure( QSharedPointer<NetworkReply>( reply ) , SIGNAL( finalUrlReached() ), this, SLOT( gotStreamUrl( boost::function< void( QSharedPointer< QIODevice >& ) >, NetworkReply* )), callback, reply );
}
void
JSResolverHelper::gotStreamUrl( boost::function< void( QSharedPointer< QIODevice >& ) > callback )
JSResolverHelper::gotStreamUrl( boost::function< void( QSharedPointer< QIODevice >& ) > callback, NetworkReply* reply )
{
NetworkReply* reply = (NetworkReply*) sender();
//boost::functions cannot accept temporaries as parameters
QSharedPointer< QIODevice > sp = QSharedPointer< QIODevice >( reply->reply(), &QObject::deleteLater );
reply->disconnectFromReply();

View File

@@ -24,6 +24,7 @@
#include "DllMacro.h"
#include "Typedefs.h"
#include "utils/NetworkReply.h"
#include <boost/function.hpp>
@@ -82,7 +83,7 @@ public slots:
void reportCapabilities( const QVariant& capabilities );
private slots:
void gotStreamUrl( boost::function< void( QSharedPointer< QIODevice >& ) > callback );
void gotStreamUrl( boost::function< void( QSharedPointer< QIODevice >& ) > callback, NetworkReply* reply );
void tracksAdded( const QList<Tomahawk::query_ptr>& tracks, const Tomahawk::ModelMode, const Tomahawk::collection_ptr& collection );
void pltemplateTracksLoadedForUrl( const QString& url, const Tomahawk::playlisttemplate_ptr& pltemplate );