public inbox for cygwin-xfree@sourceware.org
help / color / mirror / Atom feed
From: Jon TURNEY <jon.turney@dronecode.org.uk>
To: cygwin-xfree@cygwin.com
Cc: rodmedina@cantv.net
Subject: Re: XWIN-1.11.3.0 crashes when some client programs terminate.
Date: Sun, 22 Jan 2012 22:04:00 -0000	[thread overview]
Message-ID: <4F1C87DB.6000007@dronecode.org.uk> (raw)
In-Reply-To: <585051184.1267390.1327193019361.JavaMail.gess@webmail-05.datacenter.cha.cantv.net>

[-- Attachment #1: Type: text/plain, Size: 1875 bytes --]

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

[-- Attachment #2: 0001-Avoid-WIN_WINDOW_PROP-races-during-Windows-window-de.patch --]
[-- Type: text/plain, Size: 2298 bytes --]

>From 11223f32b0695423691296731a7fa3fffb95ae57 Mon Sep 17 00:00:00 2001
From: Jon TURNEY <jon.turney@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.turney@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



[-- Attachment #3: Type: text/plain, Size: 223 bytes --]

--
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	other threads:[~2012-01-22 22:04 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-22  0:43 rodmedina
2012-01-22 22:04 ` Jon TURNEY [this message]
  -- strict thread matches above, loose matches on Subject: below --
2012-01-23 15:05 rodmedina
2012-01-10  4:01 rodmedina
2012-01-10 10:29 ` Oliver Schmidt
2012-01-11 13:16 ` Jon TURNEY

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4F1C87DB.6000007@dronecode.org.uk \
    --to=jon.turney@dronecode.org.uk \
    --cc=cygwin-xfree@cygwin.com \
    --cc=rodmedina@cantv.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).