diff --git a/src/realprogressbarthread.cpp b/src/realprogressbarthread.cpp index ace2eed2e..104e14cb7 100644 --- a/src/realprogressbarthread.cpp +++ b/src/realprogressbarthread.cpp @@ -53,84 +53,72 @@ void RealProgressBarThread::refresh() condition.wakeOne(); } -//this is called inside run() -#define CHECK_INTERRUPT \ - switch(ifInterrupted())\ - {\ - case stop:\ - qDebug("RealProgressBarThread stop");\ - return;\ - case restart:\ - qDebug("RealProgressBarThread restart");\ - goto start;\ - case ignore:\ - break;\ - } - void RealProgressBarThread::run(){ - //wait for refresh or rezise slot -wait: - QMutexLocker locker(&mutex); - condition.wait(&mutex); - locker.unlock(); - - //start checking the torrent information -start: - CHECK_INTERRUPT - size_type total_size = thandle.total_size(); - size_type piece_length = thandle.piece_length(); - int num_pieces = thandle.num_pieces(); - const std::vector* pieces = thandle.pieces(); - //no vector returned - if (pieces == 0) - return; - //empty the array - locker.relock(); - for(int i=0; i queue; - thandle.get_download_queue(queue); - for(unsigned int i=0; i* pieces = thandle.pieces(); + //pieces not returned + if (pieces == 0) + { + qDebug("pieces vector not returned"); + return; + } + //empty the array + mutex.lock(); + for(int i=0; i size) - end = size; + if (end > array.size()) + end = array.size(); int start_int, end_int; qreal temp, start_frac, end_frac; start_frac = modf(start, &temp);