(no subject)

Walt Ogburn reuben at ugcs.caltech.edu
Sun Nov 7 16:50:39 CST 2004


In WIN_DestroyWindow, sending a WM_NCDESTROY may cause a window's winprocs
to be freed, but then ReleaseCapture sends a WM_CAPTURECHANGED which can
try to call the just-freed functions.  Do ReleaseCapture first so this is
safe.

If that's not acceptable for some reason, an alternative is to add a check
in winproc.c:CallWindowProc to make sure that you don't call something
that's been freed.  Maybe that would be useful in any case.

This fixes several crashes in the Aloha application mentioned by Emanuele
Gissi on wine-users.

- Walter


Changelog:
Call ReleaseCapture before sending WM_NCDESTROY when destroying a window.

Index: windows/win.c
===================================================================
RCS file: /home/wine/wine/windows/win.c,v
retrieving revision 1.250
diff -u -r1.250 win.c
--- windows/win.c       18 Oct 2004 21:25:26 -0000      1.250
+++ windows/win.c       7 Nov 2004 22:26:25 -0000
@@ -622,15 +622,15 @@
     RedrawWindow( hwnd, NULL, 0,
                   RDW_VALIDATE | RDW_NOFRAME | RDW_NOERASE | RDW_NOINTERNALPAINT | RDW_NOCHILDREN);

+    WINPOS_CheckInternalPos( hwnd );
+    if( hwnd == GetCapture()) ReleaseCapture();
+
     /*
      * Send the WM_NCDESTROY to the window being destroyed.
      */
     SendMessageA( hwnd, WM_NCDESTROY, 0, 0);

     /* FIXME: do we need to fake QS_MOUSEMOVE wakebit? */
-
-    WINPOS_CheckInternalPos( hwnd );
-    if( hwnd == GetCapture()) ReleaseCapture();

     /* free resources associated with the window */



More information about the wine-patches mailing list