From 3cb34ed7ee8bba3b1cba8e2ef09bf06a6dc6f591 Mon Sep 17 00:00:00 2001 From: Christophe Dumez Date: Sun, 16 Sep 2007 12:30:41 +0000 Subject: [PATCH] - Fixed an overflow that could cause ETA to become negative sometimes (hitted an assert) --- TODO | 2 +- src/bittorrent.cpp | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/TODO b/TODO index 040c128f9..46ecc796b 100644 --- a/TODO +++ b/TODO @@ -53,7 +53,6 @@ * beta 7 - update doc for plugins (and add screenies) - update doc for options - - See bug about negative ETA - Translations update (IN PROGRESS) - Wait that http://pastebin.ca/690649 is fixed @@ -114,6 +113,7 @@ beta6->beta7 changelog: - BUGFIX: improved search engine plugin manager code and fixed bugs - BUGFIX: Dropped Qt4.2 support, becomes too difficult to maintain - BUGFIX: Fixed deprecation warning with latest libtorrent svn +- BUGFIX: Fixed an overflow causing ETA to become negative sometimes (hitted an assert) - COSMETIC: Improved some icons - COSMETIC: Totally redesigned program preferences - COSMETIC: Improved systray tooltip style diff --git a/src/bittorrent.cpp b/src/bittorrent.cpp index 26b3366c5..be7c15de4 100644 --- a/src/bittorrent.cpp +++ b/src/bittorrent.cpp @@ -160,13 +160,14 @@ void bittorrent::updateETAs() { unsigned int nbETAs = listEtas.size(); Q_ASSERT(nbETAs); foreach(val, listEtas) { - // TODO: Remove this debug when #137223 is fixed - qDebug("old moy: %ld", (long)moy); moy += (qlonglong)((double)val/(double)nbETAs); - qDebug("ETA: %ld, nbETAs: %d, moy: %ld", (long)val, nbETAs, (long)moy); - Q_ASSERT(moy >= 0); + if(moy < 0) break; + } + if(moy < 0) { + ETAs.remove(hash); + } else { + ETAs[hash] = moy; } - ETAs[hash] = moy; } } }