Avoid a crash in free_window_handle() on an invalid window handle

Dmitry Timoshkov dmitry at baikal.ru
Fri May 13 03:34:57 CDT 2005


Hello,

an app I'm working on suffered a regression due to recent WM related
changes. The problem is caused by a recursive DestroyWindow() when
free_window_handle() might be called for an already destroyed window
handle.

Changelog:
    Dmitry Timoshkov <dmitry at codeweavers.com>
    Avoid a crash in free_window_handle() on an invalid window handle.

--- cvs/hq/wine/dlls/user/win.c	2005-05-13 10:40:58.000000000 +0900
+++ wine/dlls/user/win.c	2005-05-13 16:48:17.000000000 +0900
@@ -139,14 +139,16 @@ static WND *free_window_handle( HWND hwn
         {
             req->handle = hwnd;
             if (!wine_server_call_err( req ))
+            {
                 user_handles[index] = NULL;
+                ptr->dwMagic = 0;
+            }
             else
                 ptr = NULL;
         }
         SERVER_END_REQ;
     }
     USER_Unlock();
-    ptr->dwMagic = 0;
     HeapFree( GetProcessHeap(), 0, ptr );
     return ptr;
 }






More information about the wine-patches mailing list