mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-06 22:26:32 +02:00
tomahawk: pass the NetworkReply directly to stop segfaulting
* this now means the Google Music resolver works :)
This commit is contained in:
@@ -611,14 +611,12 @@ JSResolverHelper::returnStreamUrl( const QString& streamUrl, const QMap<QString,
|
|||||||
tDebug() << "Creating a QNetowrkReply with url:" << req.url().toString();
|
tDebug() << "Creating a QNetowrkReply with url:" << req.url().toString();
|
||||||
NetworkReply* reply = new NetworkReply( Tomahawk::Utils::nam()->get( req ) );
|
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
|
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
|
//boost::functions cannot accept temporaries as parameters
|
||||||
QSharedPointer< QIODevice > sp = QSharedPointer< QIODevice >( reply->reply(), &QObject::deleteLater );
|
QSharedPointer< QIODevice > sp = QSharedPointer< QIODevice >( reply->reply(), &QObject::deleteLater );
|
||||||
reply->disconnectFromReply();
|
reply->disconnectFromReply();
|
||||||
|
@@ -24,6 +24,7 @@
|
|||||||
|
|
||||||
#include "DllMacro.h"
|
#include "DllMacro.h"
|
||||||
#include "Typedefs.h"
|
#include "Typedefs.h"
|
||||||
|
#include "utils/NetworkReply.h"
|
||||||
|
|
||||||
#include <boost/function.hpp>
|
#include <boost/function.hpp>
|
||||||
|
|
||||||
@@ -82,7 +83,7 @@ public slots:
|
|||||||
void reportCapabilities( const QVariant& capabilities );
|
void reportCapabilities( const QVariant& capabilities );
|
||||||
|
|
||||||
private slots:
|
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 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 );
|
void pltemplateTracksLoadedForUrl( const QString& url, const Tomahawk::playlisttemplate_ptr& pltemplate );
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user