Could anybody try this patch and tell me if it fixes the issue (I cannot
reproduce myself but I may have found a possible cause for this)?

On Thu, Dec 31, 2009 at 3:49 PM, Chris <ch...@qbittorrent.org> wrote:

> The backtrace looks the same as in :
> https://bugs.launchpad.net/debian/+source/qbittorrent/+bug/501058
>
>
> On Thu, Dec 31, 2009 at 3:27 PM, Chris <ch...@qbittorrent.org> wrote:
>
>> It may also be useful the install libqt4-dbg (and get another backtrace)
>> since the error seems to be in Qt4 (when drawing the pieces downloaded bar
>> in the main properties panel).
>>
>> Best regards,
>> Chris.
>>
>>
>> On Thu, Dec 31, 2009 at 3:21 PM, Chris <ch...@qbittorrent.org> wrote:
>>
>>> I may have an idea. Does it still crash when the lower properties panel
>>> is hidden? Click on the button corresponding to the currently displayed tab
>>> to hide it.
>>> When hidden, qBittorrent no longer refreshes the panel information and
>>> the bug might be in that code.
>>>
>>
>>
>
Index: src/pieceavailabilitybar.h
===================================================================
--- src/pieceavailabilitybar.h	(revision 3220)
+++ src/pieceavailabilitybar.h	(working copy)
@@ -54,21 +54,22 @@
     double average = 0;
     if(avail.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 {
       // Look for maximum value
       uint nb_pieces = avail.size();
       average = std::accumulate(avail.begin(), avail.end(), 0)/(double)nb_pieces;
-      pixmap = QPixmap(nb_pieces, 1);
-      QPainter painter(&pixmap);
+      QPixmap pix = QPixmap(nb_pieces, 1);
+      pix.fill();
+      QPainter painter(&pix);
       std::vector<int>::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;
Index: src/downloadedpiecesbar.h
===================================================================
--- src/downloadedpiecesbar.h	(revision 3220)
+++ src/downloadedpiecesbar.h	(working copy)
@@ -55,13 +55,13 @@
   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<pieces.size(); ++i) {
         if(pieces[i])
           painter.setPen(Qt::blue);
@@ -69,6 +69,7 @@
           painter.setPen(Qt::white);
         painter.drawPoint(i,0);
       }
+      pixmap = pix;
     }
     update();
   }

Reply via email to