| Summary: | Processtable : dangerous ad buggy behaviour of processes' selection in process table | ||
|---|---|---|---|
| Product: | [Unmaintained] ksysguard | Reporter: | Lorenzo Paulatto <justforspam> |
| Component: | general | Assignee: | KSysGuard Developers <ksysguard-bugs> |
| Status: | RESOLVED FIXED | ||
| Severity: | normal | ||
| Priority: | NOR | ||
| Version First Reported In: | unspecified | ||
| Target Milestone: | --- | ||
| Platform: | openSUSE | ||
| OS: | Linux | ||
| Latest Commit: | Version Fixed/Implemented In: | ||
| Sentry Crash Report: | |||
Seems to be a bug in the 'listview with quicksearch' widget, since it turns up in KMail too: see bug 122218 SVN commit 511614 by lunakl:
Iterate only over visible items, not all of them (some may be hidden
by the search lineedit).
BUG: 122158
M +12 -16 ProcessList.cc
--- branches/KDE/3.5/kdebase/ksysguard/gui/SensorDisplayLib/ProcessList.cc #511613:511614
@@ -272,11 +272,10 @@
ProcessList::getSelectedPIds()
{
selectedPIds.clear();
- // iterate through all items of the listview and find selected processes
- QListViewItemIterator it(this);
+ // iterate through all selected visible items of the listview
+ QListViewItemIterator it(this, QListViewItemIterator::Visible | QListViewItemIterator::Selected );
for ( ; it.current(); ++it )
- if (it.current()->isSelected())
- selectedPIds.append(it.current()->text(1).toInt());
+ selectedPIds.append(it.current()->text(1).toInt());
return (selectedPIds);
}
@@ -285,14 +284,13 @@
ProcessList::getSelectedAsStrings()
{
selectedAsStrings.clear();
- // iterate through all items of the listview and find selected processes
- QListViewItemIterator it(this);
+ // iterate through all selected visible items of the listview
+ QListViewItemIterator it(this, QListViewItemIterator::Visible | QListViewItemIterator::Selected );
QString spaces;
- for ( ; it.current(); ++it )
- if (it.current()->isSelected()) {
- spaces.fill(QChar(' '), 7 - it.current()->text(1).length());
- selectedAsStrings.append("(PID: " + it.current()->text(1) + ")" + spaces + " " + it.current()->text(0));
- }
+ for ( ; it.current(); ++it ) {
+ spaces.fill(QChar(' '), 7 - it.current()->text(1).length());
+ selectedAsStrings.append("(PID: " + it.current()->text(1) + ")" + spaces + " " + it.current()->text(0));
+ }
return (selectedAsStrings);
}
@@ -868,14 +866,12 @@
/* we go through list to get all task also
when update interval is paused */
selectedPIds.clear();
- QListViewItemIterator it(this);
+ QListViewItemIterator it(this, QListViewItemIterator::Visible | QListViewItemIterator::Selected);
- // iterate through all items of the listview
+ // iterate through all selected visible items of the listview
for ( ; it.current(); ++it )
{
- if (it.current()->isSelected()) {
- selectedPIds.append(it.current()->text(1).toInt());
- }
+ selectedPIds.append(it.current()->text(1).toInt());
}
QString msg = i18n("Do you really want to send signal %1 to the selected process?",
Your fix works (tested with KDE 3.5.1 on SUSE 10.1 beta9) Thanks! |
Version: 1.2.0 (using KDE KDE 3.5.1) Installed from: SuSE RPMs OS: Linux I don't know if this problem is common to the non-SUSE version of ksysguard, but I guess it is. 1. Open ksysguard --processtable 2. enter a pretty much strict search string in the search field e.g. Searching "ine" would find both and only xinetd and kaffeine 3. Select the first process of the list, than SHIFT+CLICK on the last one, in order to select them all 4. Press "kill" Look at the confirm pop-up: you will notice that also the "hidden" processes have ben selected e.g. all the processes with a PID between the xinted and the kaffeine ones A user who doesn't pay attention will probably kick himself out of kde loosing all the unsaved work.