Index: libwnck/tasklist.c
===================================================================
RCS file: /cvs/gnome/libwnck/libwnck/tasklist.c,v
retrieving revision 1.98
diff -p -u -r1.98 tasklist.c
--- libwnck/tasklist.c	25 Mar 2006 09:04:29 -0000	1.98
+++ libwnck/tasklist.c	28 Mar 2006 21:39:54 -0000
@@ -2054,14 +2054,21 @@ wnck_tasklist_active_window_changed (Wnc
 				     WnckTasklist *tasklist)
 {
   WnckWindow *active_window;
+  WnckWindow *initial_window;
   WnckTask *active_task = NULL;
 
   /* FIXME: check for group modal window */
-  for (active_window = wnck_screen_get_active_window (screen);
-       active_window && !active_task;
-       active_window = wnck_window_get_transient (active_window))
-    active_task = g_hash_table_lookup (tasklist->priv->win_hash,
-                                       active_window);
+  initial_window = active_window = wnck_screen_get_active_window (screen);
+  active_task = g_hash_table_lookup (tasklist->priv->win_hash, active_window);
+  while (active_window && !active_task)
+    {
+      active_window = wnck_window_get_transient (active_window);
+      active_task = g_hash_table_lookup (tasklist->priv->win_hash, 
+                                         active_window);
+      /* Check for transient cycles */
+      if (active_window == initial_window)
+        break;
+    }
 
   wnck_tasklist_change_active_task (tasklist, active_task);
 }
