mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-07-31 11:20:22 +02:00
Only execute UrlHandler helper once
This commit is contained in:
@@ -32,6 +32,7 @@ public:
|
||||
NetworkReply* reply;
|
||||
IODeviceCallback callback;
|
||||
QWeakPointer<HttpIODeviceReadyHandler> ref;
|
||||
bool once = false;
|
||||
|
||||
HttpIODeviceReadyHandler( NetworkReply* _reply, IODeviceCallback _callback )
|
||||
: reply( _reply )
|
||||
@@ -44,7 +45,13 @@ public slots:
|
||||
|
||||
void called()
|
||||
{
|
||||
QSharedPointer< QIODevice > sp = QSharedPointer< QIODevice >( reply->reply(), &QObject::deleteLater );
|
||||
// Sometimes Qt calls this function twice. Weird.
|
||||
if (once) {
|
||||
deleteLater();
|
||||
}
|
||||
once = true;
|
||||
|
||||
QSharedPointer< QIODevice > sp( reply->reply(), &QObject::deleteLater );
|
||||
callback( reply->reply()->url().toString(), sp );
|
||||
|
||||
// Call once, then self-destruct
|
||||
|
Reference in New Issue
Block a user