From: Flavio Date: Sun, 1 Jan 2012 16:05:51 +0000 (+0100) Subject: Fixes for multithreaded HTTP in Qt 4.8 X-Git-Tag: 1.7~9 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=cb4317973039d6b891aabcd20cf2b82a770af809;p=minitube Fixes for multithreaded HTTP in Qt 4.8 --- diff --git a/src/downloaditem.cpp b/src/downloaditem.cpp index 8e66e29..fe8b3b6 100644 --- a/src/downloaditem.cpp +++ b/src/downloaditem.cpp @@ -31,8 +31,14 @@ DownloadItem::DownloadItem(Video *video, QUrl url, QString filename, QObject *pa } DownloadItem::~DownloadItem() { - if (m_reply) delete m_reply; - if (video) delete video; + if (m_reply) { + delete m_reply; + m_reply = 0; + } + if (video) { + delete video; + video = 0; + } } void DownloadItem::start() { @@ -111,6 +117,7 @@ void DownloadItem::tryAgain() { } void DownloadItem::downloadReadyRead() { + if (!m_reply) return; if (!m_file.isOpen()) { if (!m_file.open(QIODevice::ReadWrite)) { @@ -156,6 +163,7 @@ QString DownloadItem::errorMessage() const { } void DownloadItem::metaDataChanged() { + if (!m_reply) return; QVariant locationHeader = m_reply->header(QNetworkRequest::LocationHeader); if (locationHeader.isValid()) { m_url = locationHeader.toUrl();