[PATCH 3/14] winex11.drv: Make X11DRV_SetWindowPos able to perform most of its jobs without a valid win_data

Pierre d'Herbemont pdherbemont at free.fr
Sun Jan 21 17:35:08 CST 2007


---
   dlls/winex11.drv/winpos.c |   21 +++++++++++++++------
   1 files changed, 15 insertions(+), 6 deletions(-)

-------------- next part --------------
diff --git a/dlls/winex11.drv/winpos.c b/dlls/winex11.drv/winpos.c
index 0708b54..4e6e217 100644
--- a/dlls/winex11.drv/winpos.c
+++ b/dlls/winex11.drv/winpos.c
@@ -251,18 +251,19 @@ BOOL X11DRV_SetWindowPos( HWND hwnd, HWN
     DWORD old_style, new_style;
     BOOL ret;
 
-    if (!(data = X11DRV_get_win_data( hwnd ))) return FALSE;
+    data = X11DRV_get_win_data( hwnd );
 
     new_whole_rect = *rectWindow;
     X11DRV_window_to_X_rect( hwnd, &new_whole_rect );
 
-    old_client_rect = data->client_rect;
+    if(data)
+        old_client_rect = data->client_rect;
 
     if (!IsRectEmpty( &valid_rects[0] ))
     {
         int x_offset = 0, y_offset = 0;
 
-        if (data->whole_window)
+        if (data && data->whole_window)
         {
             /* the X server will move the bits for us */
             x_offset = data->whole_rect.left - new_whole_rect.left;
@@ -307,9 +308,10 @@ BOOL X11DRV_SetWindowPos( HWND hwnd, HWN
     }
     SERVER_END_REQ;
 
-    if (win == WND_DESKTOP || data->whole_window == DefaultRootWindow(gdi_display))
+    if (win == WND_DESKTOP || (data && data->whole_window == DefaultRootWindow(gdi_display)))
     {
-        data->whole_rect = data->client_rect = data->window_rect = *rectWindow;
+        if(data)
+            data->whole_rect = data->client_rect = data->window_rect = *rectWindow;
         if (win != WND_DESKTOP)
         {
             win->rectWindow   = *rectWindow;
@@ -338,11 +340,18 @@ BOOL X11DRV_SetWindowPos( HWND hwnd, HWN
         win->rectClient   = *rectClient;
         old_style         = win->dwStyle;
         win->dwStyle      = new_style;
-        data->window_rect = *rectWindow;
 
         TRACE( "win %p window %s client %s style %08x\n",
                hwnd, wine_dbgstr_rect(rectWindow), wine_dbgstr_rect(rectClient), new_style );
 
+        if(!data)
+        {
+            WIN_ReleasePtr( win );
+            return ret;
+        }
+
+        data->window_rect = *rectWindow;
+
         /* FIXME: copy the valid bits */
 
         if (data->whole_window && !data->lock_changes)


More information about the wine-patches mailing list