[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    Patch for kicker/taskbar
From:       Antonio Larrosa =?iso-8859-15?q?Jim=E9nez?= <larrosa () kde ! org>
Date:       2002-11-07 15:52:06
[Download RAW message or body]

Hello,

This patch fixes kicker from a complete and unrecoverable hang (which, btw, 
is not solved by "killall -9 kicker ; kicker &" because it just hangs 
before showing up when run again) when a window is moved to an 
out-of-range desktop. You can move a window to a wrong desktop for example 
just by calling "kstart --desktop 42 konsole" for example (note my next 
mail).
Note that I said "for example" because anybody can find ways to move 
windows wrong (just by calling NETWinInfo::setDesktop(42) in a broken 
app), and we don't want kicker to crash under any circumstance (IMHO) so I 
think this should be applied.

Can I commit?

Greetings,

--
Antonio Larrosa Jimenez
KDE core developer - larrosa@kde.org
http://devel-home.kde.org/~larrosa/
The only thing that interferes with my learning is my education.



["taskbar.diff" (text/x-diff)]

Index: taskbar.cpp
===================================================================
RCS file: /home/kde/kdebase/kicker/taskbar/taskbar.cpp,v
retrieving revision 1.48
diff -u -p -r1.48 taskbar.cpp
--- taskbar.cpp	2002/09/15 22:44:28	1.48
+++ taskbar.cpp	2002/11/07 15:16:21
@@ -399,14 +399,22 @@ void TaskBar::reLayout()
     // sort container list by desktop
     if ( sortByDesktop ) {
 	TaskContainerList sorted;
+	/* antlarr: look for commentary about "residue" in
+	  TaskContainer::updateFilteredTaskList() */
+	TaskContainerList residue = list;
 	for ( int desktop = -1; desktop <= taskManager()->numberOfDesktops(); desktop++ ) {
 	    for ( TaskContainerIterator it(list); it.current(); ++it ) {
 		TaskContainer* c = it.current();
 		if ( c->desktop() == desktop )
+		{
 		    sorted.append( c );
+		    residue.remove( c );
+		}    
 	    }
 	}
 	list = sorted;
+	for ( TaskContainer *c = residue.first(); c; c = residue.next() )
+            list.append( c );
     }
 
     // init content size
Index: taskcontainer.cpp
===================================================================
RCS file: /home/kde/kdebase/kicker/taskbar/taskcontainer.cpp,v
retrieving revision 1.72
diff -u -p -r1.72 taskcontainer.cpp
--- taskcontainer.cpp	2002/09/30 21:02:54	1.72
+++ taskcontainer.cpp	2002/11/07 15:16:22
@@ -813,12 +813,27 @@ void TaskContainer::updateFilteredTaskLi
     if ( sortByDesktop && ftasks.count() > 1 ) {
 
 	TaskList sorted;
+	Task *t;
+	/* antlarr: residue shouldn't be needed, as "in theory" we already
+	iterate through all applications, but kicker is a core app and we
+	don't want it to crash nor hang under any circumstance in the real
+	world, so in case a window has been moved to an out-of-range desktop
+	(which may be possible just by calling NETWinInfo::setDesktop(42) )
+	we want to keep sanity */
+	TaskList residue = ftasks;
 	for ( int desktop = -1; desktop <= taskManager->numberOfDesktops(); desktop++ ) {
-	    for ( Task *t = ftasks.first(); t; t = ftasks.next() )
+	    for ( t = ftasks.first(); t; t = ftasks.next() )
 		if ( t->desktop() == desktop )
+		{
 		    sorted.append( t );
+		    residue.remove( t );
+		}    
 	}
 	ftasks = sorted;
+
+        for ( t = residue.first(); t; t = residue.next() )
+	    ftasks.append( t );
+
     }
 }
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic