Bugs in signalplotter.cpp

Albert Astals Cid aacid at kde.org
Sun Sep 20 20:16:27 CEST 2009


Hi, not sure who's the responsible on that, blame says 73% of lines are from 
"leonhard" but CIA says he left KDE time ago, copyright mentions John so i'm 
mailing for John and plasma-devel (as replacement of leonhard).

In plasma/widgets/signalplotter.cpp there is code like this

    foreach (QList<double> data, d->plotData) {
        data.append(0);
    }


    foreach (QList<double> data, d->plotData) {
        if (newOrder.count() != data.count()) {
            kDebug() << "Serious problem in move sample.  plotdata[i] has "
                     << data.count() << " and neworder has " << 
newOrder.count();
        } else {
            QList<double> newPlot;
            for (int i = 0; i < newOrder.count(); i++) {
                int newIndex = newOrder[i];
                newPlot.append(data.at(newIndex));
            }
            data = newPlot;
        }
    }


    foreach (QList<double> data, d->plotData) {
        if ((uint)data.size() >= pos) {
            data.removeAt(pos);
        }
    }



This code does nothing, it is only working over temporary copies of the lists, 
the orginal ones are not modified, please read 
http://tsdgeos.blogspot.com/2008/04/qforeach-is-your-friend.html if you don't 
understand what i say.

Albert


More information about the Plasma-devel mailing list