From 668268b6b57016dd4b47dea3d83be40c04f2a63b Mon Sep 17 00:00:00 2001 From: Christophe Dumez Date: Fri, 26 Dec 2008 16:43:55 +0000 Subject: [PATCH] - A little downloadThread aborting improvement --- src/downloadThread.cpp | 7 +++++-- src/rss.h | 2 ++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/downloadThread.cpp b/src/downloadThread.cpp index 6407cbb7f..1ff3387a9 100644 --- a/src/downloadThread.cpp +++ b/src/downloadThread.cpp @@ -81,7 +81,7 @@ void subDownloadThread::run(){ return; } CURL *curl; - CURLcode res; + CURLcode res = (CURLcode)-1; curl = curl_easy_init(); if(curl) { std::string c_url = url.toUtf8().data(); @@ -123,10 +123,13 @@ void subDownloadThread::run(){ curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1); curl_easy_setopt(curl, CURLOPT_MAXREDIRS, -1); qDebug("Downloading %s", url.toUtf8().data()); - res = curl_easy_perform(curl); + if(!abort) + res = curl_easy_perform(curl); /* always cleanup */ curl_easy_cleanup(curl); fclose(f); + if(abort) + return; if(res) { emit downloadFailureST(this, url, errorCodeToString(res)); } else { diff --git a/src/rss.h b/src/rss.h index 7644e92e6..aa52b3e0b 100644 --- a/src/rss.h +++ b/src/rss.h @@ -668,7 +668,9 @@ class RssManager : public QObject{ ~RssManager(){ qDebug("Deleting RSSManager"); saveStreamList(); + qDebug("Deleting all streams"); qDeleteAll(streams); + qDebug("Deleting downloader thread"); delete downloader; qDebug("RSSManager deleted"); }