Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/metacity/ChangeLog,v
retrieving revision 1.771
diff -u -p -u -r1.771 ChangeLog
--- ChangeLog	30 Nov 2003 03:30:25 -0000	1.771
+++ ChangeLog	13 Dec 2003 03:53:45 -0000
@@ -1,3 +1,9 @@
+2003-12-12  Havoc Pennington  <hp@redhat.com>
+
+	* src/window.c (meta_window_free): unstick window to get it out of
+	mru_list it should not be in; assert that window has been removed
+	from all mru_list. Perhaps fixes #122016
+
 2003-11-29  Havoc Pennington  <hp@redhat.com>
 
 	* fix up compositing manager to somewhat work
Index: src/window.c
===================================================================
RCS file: /cvs/gnome/metacity/src/window.c,v
retrieving revision 1.314
diff -u -p -u -r1.314 window.c
--- src/window.c	24 Nov 2003 23:05:04 -0000	1.314
+++ src/window.c	13 Dec 2003 03:53:46 -0000
@@ -944,6 +944,12 @@ meta_window_free (MetaWindow  *window)
   meta_window_unqueue_move_resize (window);
   meta_window_unqueue_update_icon (window);
   meta_window_free_delete_dialog (window);
+
+  /* We need to unstick to remove the window from
+   * any workspace->mru_list for workspaces not
+   * in window->workspaces
+   */
+  meta_window_unstick (window);
   
   tmp = window->workspaces;
   while (tmp != NULL)
@@ -960,6 +966,19 @@ meta_window_free (MetaWindow  *window)
 
   g_assert (window->workspaces == NULL);
 
+#ifndef G_DISABLE_CHECKS
+  tmp = window->screen->workspaces;
+  while (tmp != NULL)
+    {
+      MetaWorkspace *workspace = tmp->data;
+
+      g_assert (g_list_find (workspace->windows, window) == NULL);
+      g_assert (g_list_find (workspace->mru_list, window) == NULL);
+
+      tmp = tmp->next;
+    }
+#endif
+  
   meta_stack_remove (window->screen->stack, window);
   
   /* FIXME restore original size if window has maximized */
@@ -3243,7 +3262,7 @@ meta_window_stick (MetaWindow  *window)
     {
       workspace = (MetaWorkspace *) tmp->data;
       if (!g_list_find (workspace->mru_list, window))
-          workspace->mru_list = g_list_append (workspace->mru_list, window);
+        workspace->mru_list = g_list_append (workspace->mru_list, window);
 
       tmp = tmp->next;
     }
@@ -3272,7 +3291,7 @@ meta_window_unstick (MetaWindow  *window
     {
       workspace = (MetaWorkspace *) tmp->data;
       if (!meta_workspace_contains_window (workspace, window))
-           workspace->mru_list = g_list_remove (workspace->mru_list, window);
+        workspace->mru_list = g_list_remove (workspace->mru_list, window);
       tmp = tmp->next;
     }
 
Index: src/workspace.c
===================================================================
RCS file: /cvs/gnome/metacity/src/workspace.c,v
retrieving revision 1.47
diff -u -p -u -r1.47 workspace.c
--- src/workspace.c	20 Sep 2003 04:58:25 -0000	1.47
+++ src/workspace.c	13 Dec 2003 03:53:47 -0000
@@ -85,6 +85,7 @@ meta_workspace_free (MetaWorkspace *work
     }
 
   g_assert (workspace->windows == NULL);
+  g_assert (workspace->mru_list == NULL);
 
   screen = workspace->screen;
   
