From abf027ab7031e08523fd368fbb343f528b9e64c7 Mon Sep 17 00:00:00 2001 From: Timon Wong Date: Wed, 8 May 2013 22:50:06 +0800 Subject: [PATCH] Fix crashes due to deletion resources owned by QNetworkAccessManager --- webmultimediadownload.cc | 12 ++++++------ webmultimediadownload.hh | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/webmultimediadownload.cc b/webmultimediadownload.cc index 0dc2dad8..549091ba 100644 --- a/webmultimediadownload.cc +++ b/webmultimediadownload.cc @@ -14,19 +14,19 @@ WebMultimediaDownload::WebMultimediaDownload( QUrl const & url, void WebMultimediaDownload::cancel() { - reply.reset(); + reply = NULL; finish(); } void WebMultimediaDownload::replyFinished( QNetworkReply * r ) { - if ( r != reply.get() ) + if ( r != reply ) return; // Not our reply - if ( reply->error() == QNetworkReply::NoError ) + if ( r->error() == QNetworkReply::NoError ) { - QByteArray all = reply->readAll(); + QByteArray all = r->readAll(); Mutex::Lock _( dataMutex ); @@ -37,11 +37,11 @@ void WebMultimediaDownload::replyFinished( QNetworkReply * r ) hasAnyData = true; } else - setErrorString( reply->errorString() ); + setErrorString( r->errorString() ); finish(); - reply.reset(); + reply = NULL; } bool WebMultimediaDownload::isAudioUrl( QUrl const & url ) diff --git a/webmultimediadownload.hh b/webmultimediadownload.hh index e70bafa8..10e4831e 100644 --- a/webmultimediadownload.hh +++ b/webmultimediadownload.hh @@ -12,7 +12,7 @@ class WebMultimediaDownload: public DataRequest { Q_OBJECT - sptr< QNetworkReply > reply; + QNetworkReply * reply; public: