mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-03-20 07:49:42 +01:00
Only execute UrlHandler helper once
This commit is contained in:
parent
73c160eaaa
commit
be5e82cb78
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user