From: Flavio Date: Wed, 26 Jan 2011 00:47:20 +0000 (+0100) Subject: Fixed small leak X-Git-Tag: 1.4~36 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=78da2111356c1f3613fcbd8309f8b65d618844c3;p=minitube Fixed small leak --- diff --git a/src/downloaditem.cpp b/src/downloaditem.cpp index c5192e7..4c26c87 100644 --- a/src/downloaditem.cpp +++ b/src/downloaditem.cpp @@ -20,6 +20,11 @@ DownloadItem::DownloadItem(Video *video, QUrl url, QString filename, QObject *pa , m_status(Idle) { } +DownloadItem::~DownloadItem() { + if (m_reply) delete m_reply; + if (video) delete video; +} + void DownloadItem::start() { m_reply = The::http()->simpleGet(m_url); init(); @@ -159,12 +164,12 @@ void DownloadItem::downloadProgress(qint64 bytesReceived, qint64 bytesTotal) { percent = bytesReceived * 100 / bytesTotal; } - // qDebug() << bytesReceived << bytesTotal; + // qDebug() << bytesReceived << bytesTotal << bytesTotal * .005 << m_downloadTime.msecsTo(now) << percent; if (m_status != Downloading - && bytesReceived > 1024 * 1024 + && bytesReceived > 1024 * 512 && bytesReceived > bytesTotal * .01 - && m_downloadTime.msecsTo(now) > 2000 ) { + && m_downloadTime.msecsTo(now) > 1500 ) { m_status = Downloading; emit statusChanged(); } @@ -206,6 +211,7 @@ void DownloadItem::requestFinished() { m_reply = 0; m_finishedDownloading = true; if (!m_startedSaving) { + qDebug() << "Request finished but never started saving"; return; } m_file.close(); diff --git a/src/downloaditem.h b/src/downloaditem.h index 7ccf4db..b4f59f5 100644 --- a/src/downloaditem.h +++ b/src/downloaditem.h @@ -25,6 +25,7 @@ signals: public: DownloadItem(Video *video, QUrl url, QString filename, QObject *parent = 0); + ~DownloadItem(); qint64 bytesTotal() const; qint64 bytesReceived() const; double remainingTime() const;