From aa2ee0fde2dcd33795ce4d3904d6da21d4bb09e8 Mon Sep 17 00:00:00 2001
From: marha <marha@users.sourceforge.net>
Date: Thu, 26 Jan 2012 08:27:33 +0100
Subject: Solved the problem of the WIN_WINDOW_PROP property being NULL in a
 window in another way

---
 xorg-server/hw/xwin/winmultiwindowwindow.c  |  2 --
 xorg-server/hw/xwin/winmultiwindowwndproc.c | 11 +++++++----
 2 files changed, 7 insertions(+), 6 deletions(-)

(limited to 'xorg-server/hw')

diff --git a/xorg-server/hw/xwin/winmultiwindowwindow.c b/xorg-server/hw/xwin/winmultiwindowwindow.c
index f87da410e..836587f74 100644
--- a/xorg-server/hw/xwin/winmultiwindowwindow.c
+++ b/xorg-server/hw/xwin/winmultiwindowwindow.c
@@ -611,8 +611,6 @@ winDestroyWindowsWindow (WindowPtr pWin)
   hIcon = (HICON)SendMessage(pWinPriv->hWnd, WM_GETICON, ICON_BIG, 0);
   hIconSm = (HICON)SendMessage(pWinPriv->hWnd, WM_GETICON, ICON_SMALL, 0);
 
-  SetProp (pWinPriv->hWnd, WIN_WINDOW_PROP, NULL);
-
   /* Destroy the Windows window */
   DestroyWindow (pWinPriv->hWnd);
 
diff --git a/xorg-server/hw/xwin/winmultiwindowwndproc.c b/xorg-server/hw/xwin/winmultiwindowwndproc.c
index eb2b51020..f4313d353 100644
--- a/xorg-server/hw/xwin/winmultiwindowwndproc.c
+++ b/xorg-server/hw/xwin/winmultiwindowwndproc.c
@@ -363,10 +363,12 @@ winTopLevelWindowProc (HWND hwnd, UINT message,
       fWMMsgInitialized = TRUE;
 
     }
+  #ifdef _DEBUG
   else if (message!=WM_CREATE)
-    {  // Avoid crashes when pWin == NULL, which happens sometimes (I think during closing of windows)
-      return DefWindowProc (hwnd, message, wParam, lParam);
+    {
+      ErrorLog("Error; WIN_WINDOW_PROP should be different from NULL\n");
     }
+  #endif
 
   /* Branch on message type */
   switch (message)
@@ -699,9 +701,10 @@ winTopLevelWindowProc (HWND hwnd, UINT message,
 
       /* Remove our keyboard hook if it is installed */
       winRemoveKeyboardHookLL ();
+       /* Revert the X focus as well, but only if the Windows focus is going to another window */
       if (!wParam)
-	/* Revert the X focus as well, but only if the Windows focus is going to another window */
-	DeleteWindowFromAnyEvents(pWin, FALSE);
+	if (pWin)
+	  DeleteWindowFromAnyEvents(pWin, FALSE);
       return 0;
 
     case WM_SYSDEADCHAR:      
-- 
cgit v1.2.3