Package: kcollectd Version: 0.9-2.1 Severity: normal Tags: patch --- Please enter the report below this line. --- The attached patch addresses two issues:
1) When many lines are present in a graph, resizing the window too small causes the program to enter into an infinite loop. This patch avoids that loop. It's less than idea---a better patch would enforce a minimum window size. But the present behavior is far superior to the crash, and is very simple. 2) The X-axis labels are in the "windowText" color, which depends on the color scheme. The background color, however is always white. In inverted color schemes, this text can become difficult to read, or invisible (in particular, in the Breeze Dark High Contrast scheme shipped with KDE). The color is chosen to be black, the same choice as made with the Y-labels. Thanks, Antonio Russo --- System information. --- Architecture: amd64 Kernel: Linux 4.4.0-trunk-amd64 Debian Release: stretch/sid 501 stable packages.x2go.org 300 testing ftp.us.debian.org 251 unstable www.deb-multimedia.org 251 testing www.deb-multimedia.org 251 experimental www.deb-multimedia.org 250 unstable ftp.us.debian.org 200 experimental ftp.us.debian.org 150 stable dl.google.com --- Package information. --- Depends (Version) | Installed ==========================================-+-============= kde-runtime (>> 4:4.10) | 4:15.08.3-1+b1 libboost-filesystem1.55.0 | libboost-system1.55.0 | libc6 (>= 2.14) | libgcc1 (>= 1:4.1.1) | libkdecore5 (>= 4:4.3.4) | libkdeui5 (>= 4:4.3.4) | libkio5 (>= 4:4.3.4) | libqt4-dbus (>= 4:4.5.3) | libqt4-network (>= 4:4.5.3) | libqt4-svg (>= 4:4.5.3) | libqt4-xml (>= 4:4.5.3) | libqtcore4 (>= 4:4.8.0) | libqtgui4 (>= 4:4.5.3) | librrd4 (>= 1.3.0) | libstdc++6 (>= 4.2.1) | collectd | Package's Recommends field is empty. Suggests (Version) | Installed ===========================-+-=========== khelpcenter4 |
--- kcollectd/graph.cc.old 2016-02-15 13:39:31.667208200 -0800 +++ kcollectd/graph.cc 2016-02-15 13:35:16.260748798 -0800 @@ -351,7 +351,6 @@ const linMap xmap(data_start, left, data_end, right); // draw labels - paint.setPen(palette().windowText().color()); if (center) --i; for(; *i <= data_end; ++i) { // special handling for localtime/mktime on DST @@ -486,7 +485,12 @@ // make sure labels don not overlap const int fontheight = fontmetric.height(); - while(rect.height() < fontheight * (y_range.max()-y_range.min())/base) + + // if we cannot even fit the text, just abort instead of crashing + if (rect.height() < fontheight) + return; + + while(rect.height() < fontheight * (y_range.max()-y_range.min())/base) if (rect.height() > fontheight * (y_range.max()-y_range.min())/base/2) base *= 2; else if (rect.height() > fontheight * (y_range.max()-y_range.min())/base/5)