diff --git a/windows/winpos.c b/windows/winpos.c
index 67d230aebd0..1c6fb94195b 100644
--- a/windows/winpos.c
+++ b/windows/winpos.c
@@ -2636,7 +2636,7 @@ Pos:  /* -----------------------------------------------------------------------
 
     wvrFlags = SWP_DoNCCalcSize( wndPtr, &winpos, &newWindowRect, &newClientRect, flags );
 
-    if(!(winpos.flags & SWP_NOZORDER))
+    if(!(winpos.flags & SWP_NOZORDER) && winpos.hwnd != hwndInsertAfter)
     {
         if ( WIN_UnlinkWindow( winpos.hwnd ) )
 	   WIN_LinkWindow( winpos.hwnd, hwndInsertAfter );