Bug 128306

Summary: bar graph produces error
Product: [Unmaintained] ksysguard Reporter: Jiri Hofman <hofmanj>
Component: generalAssignee: KSysGuard Developers <ksysguard-bugs>
Status: RESOLVED FIXED    
Severity: normal CC: gerhofer, safalco
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Gentoo Packages   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: patch
corrected patch

Description Jiri Hofman 2006-05-30 09:44:17 UTC
Version:           1.2.0 (using KDE KDE 3.5.2)
Installed from:    Gentoo Packages
Compiler:          gcc 3.4.6 
OS:                Linux

If a bar graph is chosen, only a small orange lightning flash in the top left corner is displayed.

State of the sensor is: Error.
Comment 1 Greg Martyn 2006-06-02 06:25:37 UTC
That's usually because the data that the graph was monitoring has disappeared.

The bar graph works for me. What steps did you take to cause this error?
Comment 2 Jiri Hofman 2006-06-03 11:13:31 UTC
Well, I have done nothing. I just started ksysguard and tried to use a bar graph with some of the sensors. No sensor worked (but they work with other types of graphs). It seems, I am not the only one with this problem, see http://forums.gentoo.org/viewtopic-t-466716-highlight-.html
Comment 3 Gerald Hofer 2006-07-07 02:43:07 UTC
I am confirming that problem on a different platform:

SuSE 10.1 works ok (kdebase3-3.5.1-69.15)

After upgrading to the latest KDE packages built by OpenSuSE  http://software.opensuse.org/download/KDE:/KDE3/
to kdebase3-3.5.3-21.2 I see the exact same behaviour.

The sensor is working fine as Signal Plotter or as Multimeter but as BarGraph I get an error and the orange lightning flash is displayed in the top left corner.
Comment 4 Dimitar Marinov 2006-07-23 09:56:08 UTC
I have the same problem with Debian testing and Debian unstable since kde 3.5.3
Comment 5 Steve Falco 2006-07-27 16:08:06 UTC
I just upgraded my Fedora 5 system to kdebase-3.4.0-5, and I have the problem too.  No sensors work in a bar graph, but the same sensors work fine in a signal plotter or multimeter.  As reported by others, the sensor status is "error", and there is a lightning bolt in the upper left.
Comment 6 Steve Falco 2006-07-27 16:09:44 UTC
Arggg... That should have been kdebase-3.5.3-0.4.fc5.  Sorry.
Comment 7 Steve Falco 2006-07-27 18:00:54 UTC
Created attachment 17141 [details]
patch
Comment 8 Steve Falco 2006-07-27 18:02:02 UTC
I have attached a patch that fixes the problem.  The QBitArray does not want a bit-shift, it wants the integer value itself.
Comment 9 Steve Falco 2006-07-27 18:38:03 UTC
Created attachment 17142 [details]
corrected patch

Here is a corrected patch.  What is wanted is to check to be sure that all bits
of the mFlags have been set.  So, I added a loop to verify that all updates
have been received before applying the updated samples.
Comment 10 Tobias Koenig 2006-08-01 11:02:31 UTC
SVN commit 568458 by tokoe:

Fixed bug #128306 like proposed in the patch, just with a small cleanup ;)
Thank you very much!

BUGS: 128306


 M  +5 -1      DancingBars.cc  


--- branches/KDE/3.5/kdebase/ksysguard/gui/SensorDisplayLib/DancingBars.cc #568457:568458
@@ -253,7 +253,11 @@
     }
     mFlags.setBit( id, true );
 
-    if ( mFlags.testBit( ( 1 << mBars ) - 1 ) == true ) {
+    bool allBitsAvailable = true;
+    for ( uint i = 0; i < mBars; ++i )
+      allBitsAvailable &= mFlags.testBit( i );
+
+    if ( allBitsAvailable ) {
       mPlotter->updateSamples( mSampleBuffer );
       mFlags.fill( false );
     }
Comment 11 Steve Falco 2006-08-03 03:09:32 UTC
Glad to be able to help!  And I like your cleanup - it is a very readable way to code that test.