On 22/01/2012 00:43, rodmedina wrote:
> I was on vacation so I couldn't replay.  3 days ago I tried to reproduce the 
> crash,
> but it did not happen!  I have not installed new software since the previous 
> crash,
>  niether cygwin nor Windows.  I do not understand how that can be. The only
> difference I can think of is that when the crashes happened 2 weeks ago I had 
> ben working
> for a long time with the machine. Three days ago I just booted the machine 
> and tried to
> reproduce the crash.  Today I tried again and the crash was back again (my 
> wife had been
> using the machine all day). I have made the backtrace as suggested. It is 
> attached 
> together with the XWin.0.log.
> In order to have the crash you have to interact for a while with the test 
> program
> and then close the window. 

Thanks very much for the backtrace.  This helps a great deal, and I can see
what I think is causing this problem.

It looks like there is a race condition during window destruction, if we
process a WM_KILLFOCUS message just as we are deleting the window, which could
cause this crash.

I've applied a couple of fixes to address this, both by removing the race
condition, and avoiding the particular crash occurring in your case, so
hopefully this works better now. I've uploaded a snapshot at [1]. Perhaps you
could try that out and see if that makes a difference?

> About the locale non working, I start the X server with a windows batch 
> script that makes
> the following sets before running XWin:

> SET LC_ALL=es_VEN.ISO-8859-1

I don't think this is valid as we are expecting a 2-character ISO 3166 code
here, which for Venezuela is VE.

This doesn't match what's reported in your cygcheck.out, so I don't know if
you've made a typo somewhere.

[1] ftp://cygwin.com/pub/cygwinx/XWin.20120122-git-e8802abd6e2953e0.exe.bz2

-- 
Jon TURNEY
Volunteer Cygwin/X X Server maintainer
>From 11223f32b0695423691296731a7fa3fffb95ae57 Mon Sep 17 00:00:00 2001
From: Jon TURNEY <jon.tur...@dronecode.org.uk>
Date: Sun, 22 Jan 2012 19:31:51 +0000
Subject: [PATCH] Avoid WIN_WINDOW_PROP races during Windows window
 destruction

The WIN_WINDOW_PROP is removed during WM_DESTROY handling, so it is not 
neccessary to
remove it in winDestroyWindowsWindow(), and doing so opens a race condition, as 
we may
attempt to access that property in the wndproc before the WM_DESTROY has 
completed.

A specific example of that race is if a WM_KILLFOCUS occurs in the window 
between property
removal and WM_DESTROY processing, where we will attempt to apply 
DeletWindowFromAnyEvents()
on an invalid (null) WindowPtr.

Also guard against null WindowPtr in the WM_KILLFOCUS handler

See http://cygwin.com/ml/cygwin-xfree/2012-01/msg00009.html

Signed-off-by: Jon TURNEY <jon.tur...@dronecode.org.uk>
---
 hw/xwin/winmultiwindowwindow.c  |    2 --
 hw/xwin/winmultiwindowwndproc.c |    7 +++++--
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/hw/xwin/winmultiwindowwindow.c b/hw/xwin/winmultiwindowwindow.c
index 2329d16..aabde6b 100644
--- a/hw/xwin/winmultiwindowwindow.c
+++ b/hw/xwin/winmultiwindowwindow.c
@@ -638,8 +638,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/hw/xwin/winmultiwindowwndproc.c b/hw/xwin/winmultiwindowwndproc.c
index 454dd5f..d76bb2b 100644
--- a/hw/xwin/winmultiwindowwndproc.c
+++ b/hw/xwin/winmultiwindowwndproc.c
@@ -714,9 +714,12 @@ 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:      
-- 
1.7.5.1


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://x.cygwin.com/docs/
FAQ:                   http://x.cygwin.com/docs/faq/

Reply via email to