Skip to content
Permalink
Browse files

Fix leaks, multiple connects in QgsFileDownloader

  • Loading branch information
nyalldawson committed Feb 7, 2017
1 parent 826a867 commit cb1849ffa207550569e1ce26911b95bfe9b10f6b
Showing with 10 additions and 3 deletions.
  1. +10 −3 src/gui/qgsfiledownloader.cpp
@@ -57,15 +57,22 @@ void QgsFileDownloader::startDownload()
QgsNetworkAccessManager* nam = QgsNetworkAccessManager::instance();

QNetworkRequest request( mUrl );

if ( mReply )
{
disconnect( mReply, &QNetworkReply::readyRead, this, &QgsFileDownloader::onReadyRead );
disconnect( mReply, &QNetworkReply::finished, this, &QgsFileDownloader::onFinished );
disconnect( mReply, &QNetworkReply::downloadProgress, this, &QgsFileDownloader::onDownloadProgress );
mReply->abort();
mReply->deleteLater();
}
mReply = nam->get( request );

connect( mReply, &QNetworkReply::readyRead, this, &QgsFileDownloader::onReadyRead );
connect( mReply, &QNetworkReply::finished, this, &QgsFileDownloader::onFinished );
connect( mReply, &QNetworkReply::downloadProgress, this, &QgsFileDownloader::onDownloadProgress );
connect( nam, &QgsNetworkAccessManager::requestTimedOut, this, &QgsFileDownloader::onRequestTimedOut );
connect( nam, &QgsNetworkAccessManager::requestTimedOut, this, &QgsFileDownloader::onRequestTimedOut, Qt::UniqueConnection );
#ifndef QT_NO_SSL
connect( nam, &QgsNetworkAccessManager::sslErrors, this, &QgsFileDownloader::onSslErrors );
connect( nam, &QgsNetworkAccessManager::sslErrors, this, &QgsFileDownloader::onSslErrors, Qt::UniqueConnection );
#endif
if ( mGuiNotificationsEnabled )
{

0 comments on commit cb1849f

Please sign in to comment.
You can’t perform that action at this time.