Bug 135760

Summary: Dangerous behaviour of process table when filtering processes and selecting
Product: [Applications] ksysguard Reporter: Xtracto <xtracto>
Component: generalAssignee: KSysGuard Developers <ksysguard-bugs>
Status: RESOLVED FIXED    
Severity: major CC: me
Priority: HI    
Version: unspecified   
Target Milestone: ---   
Platform: Fedora RPMs   
OS: Linux   
Latest Commit: Version Fixed In:

Description Xtracto 2006-10-16 18:02:53 UTC
Version:           1.2.0 (using KDE KDE 3.5.3)
Installed from:    Fedora RPMs
OS:                Linux

Go to the "Process Table" tab and then write int he search box the text "sy" (without quotes). After that, 2 or 3 processes will be shown. Click on the first process and then select the remaining processes by clicking holding SHIFT and clicking on the last process, this will effectively select all of the displayed processes.

Now remove the "sy" from the search text and all the available processes will be shown. Unexpectedly, other processes than the ones selected will be selected (this is, when selecting with the SHIFT key you actually select a *range* of items from the list but the range unfiltered with the current search filter).

This is a dangerous behaviour as when looking for one or two instances of an application that is freezed the first thing you will do is filter the name of the application and then select the multiple apps and KILL them (with the kill button).

Dont know if later versions have the same problem.
Comment 1 Bram Schoenmakers 2006-10-16 19:03:21 UTC
Strange, since bug 122158 was fixed since KDE 3.5.2. Could you please check if you're using the latest kdebase packages?
Comment 2 Bram Schoenmakers 2006-10-31 16:00:47 UTC
Scratch my last comment. Bug 122158 fixes only a part of the problem.
Comment 3 John Tapsell 2006-11-23 13:25:15 UTC
Ouch, this sucks!
Comment 4 John Tapsell 2006-11-29 00:16:57 UTC
SVN commit 608934 by johnflux:

Mostly fix the selection of processes.  It's impossible to fix 100% because of stupid stupid race conditions that I cannot avoid without rewriting the search box.

This is inherently fixed (i,e. fixed by design) in kde4.

Closing bug.  It's as good as it's going to get.

Thank you Xtracto for a clear bug report with exact instructions to repeat :-)

BUG:135760



 M  +3 -3      ProcessList.cc  


--- branches/KDE/3.5/kdebase/ksysguard/gui/SensorDisplayLib/ProcessList.cc #608933:608934
@@ -680,7 +680,7 @@
 	// iterate through all items of the listview
 	for ( ; it.current(); ++it )
 	{
-		if (it.current()->isSelected())
+		if (it.current()->isSelected() && it.current()->isVisible())
 			selectedPIds.append(it.current()->text(1).toInt());
 		if (treeViewEnabled && !it.current()->isOpen())
 			closedSubTrees.append(it.current()->text(1).toInt());
@@ -910,7 +910,7 @@
 {
 	selectedPIds.clear();
 
-	QListViewItemIterator it(this);
+	QListViewItemIterator it(this, QListViewItemIterator::Visible);
 
 	// iterate through all items of the listview
 	for ( ; it.current(); ++it )
@@ -925,7 +925,7 @@
 void
 ProcessList::selectAllChilds(int pid, bool select)
 {
-	QListViewItemIterator it(this);
+	QListViewItemIterator it(this, QListViewItemIterator::Visible );
 
 	// iterate through all items of the listview
 	for ( ; it.current(); ++it )