mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-06 14:16:32 +02:00
Avoid copying of constructor results
This commit is contained in:
@@ -95,7 +95,7 @@ localFileIODeviceFactory( const Tomahawk::result_ptr&, const QString& url,
|
|||||||
io->open( QIODevice::ReadOnly );
|
io->open( QIODevice::ReadOnly );
|
||||||
|
|
||||||
// std::functions cannot accept temporaries as parameters
|
// std::functions cannot accept temporaries as parameters
|
||||||
QSharedPointer< QIODevice > sp = QSharedPointer<QIODevice>( io );
|
QSharedPointer< QIODevice > sp( io );
|
||||||
callback( url, sp );
|
callback( url, sp );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -903,7 +903,7 @@ void
|
|||||||
JSResolverHelper::gotStreamUrl( std::function< void( const QString&, QSharedPointer< QIODevice >& ) > callback, NetworkReply* reply )
|
JSResolverHelper::gotStreamUrl( std::function< void( const QString&, QSharedPointer< QIODevice >& ) > callback, NetworkReply* reply )
|
||||||
{
|
{
|
||||||
// std::functions cannot accept temporaries as parameters
|
// std::functions cannot accept temporaries as parameters
|
||||||
QSharedPointer< QIODevice > sp = QSharedPointer< QIODevice >( reply->reply(), &QObject::deleteLater );
|
QSharedPointer< QIODevice > sp ( reply->reply(), &QObject::deleteLater );
|
||||||
QString url = reply->reply()->url().toString();
|
QString url = reply->reply()->url().toString();
|
||||||
reply->disconnectFromReply();
|
reply->disconnectFromReply();
|
||||||
reply->deleteLater();
|
reply->deleteLater();
|
||||||
|
Reference in New Issue
Block a user