From 6d88bb5b83542db2bb66ca25916a02565c319dfb Mon Sep 17 00:00:00 2001 From: Christophe Dumez Date: Thu, 31 Dec 2009 15:10:30 +0000 Subject: [PATCH] - Made sure the pixmap cannot be drawn with uninitialized data --- src/downloadedpiecesbar.h | 13 +++++++------ src/pieceavailabilitybar.h | 13 +++++++------ 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/downloadedpiecesbar.h b/src/downloadedpiecesbar.h index 8ab6b1a65..6f4788b66 100644 --- a/src/downloadedpiecesbar.h +++ b/src/downloadedpiecesbar.h @@ -55,13 +55,13 @@ public: void setProgress(bitfield pieces) { if(pieces.empty()) { // Empty bar - pixmap = QPixmap(1, 1); - QPainter painter(&pixmap); - painter.setPen(Qt::white); - painter.drawPoint(0,0); + QPixmap pix = QPixmap(1, 1); + pix.fill(); + pixmap = pix; } else { - pixmap = QPixmap(pieces.size(), 1); - QPainter painter(&pixmap); + QPixmap pix = QPixmap(pieces.size(), 1); + pix.fill(); + QPainter painter(&pix); for(uint i=0; i::iterator it; for(uint i=0; i < nb_pieces; ++i) { painter.setPen(getPieceColor(avail[i], average)); painter.drawPoint(i,0); } + pixmap = pix; } update(); return average;