Index: src/frame.c
===================================================================
--- src/frame.c	(revision 3190)
+++ src/frame.c	(working copy)
@@ -197,7 +197,10 @@ meta_window_destroy_frame (MetaWindow *w
   XReparentWindow (window->display->xdisplay,
                    window->xwindow,
                    window->screen->xroot,
-                   /* FIXME where to put it back depends on the gravity */
+                   /* FIXME where to put it back depends on the gravity; be
+                    * sure to keep this consistent with FIXME in
+                    * window.c:send_configure_notify().
+                    */
                    window->frame->rect.x,
                    window->frame->rect.y);
   meta_error_trap_pop (window->display, FALSE);
Index: src/window.c
===================================================================
--- src/window.c	(revision 3190)
+++ src/window.c	(working copy)
@@ -1015,6 +1015,11 @@ meta_window_free (MetaWindow  *window,
 
   if (window->maximized_horizontally || window->maximized_vertically)
     unmaximize_window_before_freeing (window);
+
+  /* See FIXME in frame.c:meta_window_destroy_frame() with XReparentWindow
+   * call + bug 399552.
+   */
+  send_configure_notify (window);
   
   meta_window_unqueue_calc_showing (window);
   meta_window_unqueue_move_resize (window);
@@ -2390,8 +2395,6 @@ unmaximize_window_before_freeing (MetaWi
   if (window->withdrawn)                /* See bug #137185 */
     {
       window->rect = window->saved_rect;
-      send_configure_notify (window);
-
       set_net_wm_state (window);
     }
   else if (window->screen->closing)     /* See bug #358042 */
@@ -5393,9 +5396,23 @@ send_configure_notify (MetaWindow *windo
   event.xconfigure.y = window->rect.y - window->border_width;
   if (window->frame)
     {
-      /* Need to be in root window coordinates */
-      event.xconfigure.x += window->frame->rect.x;
-      event.xconfigure.y += window->frame->rect.y;
+      if (window->withdrawn)
+        {
+          /* FIXME: x & y need to be modified depending on the
+           * window's gravity.  By not modifying them, we are assuming
+           * NorthWestGravity, I think.
+           *
+           * And, uh, this FIXME also needs to be consistent with the one
+           * in XReparentWindow call in meta_window_destroy_frame() in
+           * frame.c.
+           */
+        }
+      else
+        {
+          /* Need to be in root window coordinates */
+          event.xconfigure.x += window->frame->rect.x;
+          event.xconfigure.y += window->frame->rect.y;
+        }
     }
   event.xconfigure.width = window->rect.width;
   event.xconfigure.height = window->rect.height;
