[Wine-patches] [eterhack 2/2] winex11.drv: Fix interthread deadlocks caused by Etersoft hacks. (eterbug #8330)

Dmitry Timoshkov dtimoshkov на etersoft.ru
Ср Окт 17 10:43:46 MSK 2012


---
 dlls/winex11.drv/event.c  | 11 ++++++++---
 dlls/winex11.drv/window.c | 11 ++++++-----
 2 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/dlls/winex11.drv/event.c b/dlls/winex11.drv/event.c
index bf40330..07132ec 100644
--- a/dlls/winex11.drv/event.c
+++ b/dlls/winex11.drv/event.c
@@ -738,14 +738,16 @@ static BOOL etersoft_focus_out( HWND hwnd, XFocusChangeEvent *event)
 {
     DEFETER_FUNC(etersoft_1version);
     struct x11drv_win_data *data;
+    BOOL is_managed;
 
     /* EterBug 2728 */
     /* Emulate the caption clicking for the X window with popup listbox */
     data = get_win_data( hwnd );
-    if (!data)
-        return FALSE;
+    if (!data) return FALSE;
+    is_managed = data->managed;
+    release_win_data( data );
 
-    if (data->managed)
+    if (is_managed)
     {
         POINT pt;
         LRESULT res;
@@ -767,6 +769,8 @@ static BOOL etersoft_focus_out( HWND hwnd, XFocusChangeEvent *event)
             return FALSE;
     }
 
+    data = get_win_data( hwnd );
+    if (!data) return FALSE;
     if (data->managed && data->whole_window && (event->detail != NotifyAncestor))
     {
         if (getenv("WINEENABLERAISE"))
@@ -775,6 +779,7 @@ static BOOL etersoft_focus_out( HWND hwnd, XFocusChangeEvent *event)
             update_net_wm_states( data );
         }
     }
+    release_win_data( data );
     return TRUE;
 }
 
diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c
index 654c8a9..ca382c4 100644
--- a/dlls/winex11.drv/window.c
+++ b/dlls/winex11.drv/window.c
@@ -238,7 +238,6 @@ static BOOL has_owned_popups( HWND hwnd )
     return result.found;
 }
 
-
 /***********************************************************************
  *		is_window_managed
  *
@@ -2213,10 +2212,12 @@ void CDECL X11DRV_DropWindow( HWND hwnd )
     if (GetWindowLongW(hwnd, GWL_STYLE) & WS_MINIMIZE) return;
     if (!(hwnd = GetAncestor( hwnd, GA_ROOT ))) return;
     if (!(data = get_win_data( hwnd ))) return;
-    if (!data->managed) return;
-
-    SetWindowLongW(hwnd, GWL_EXSTYLE, GetWindowLongW( hwnd, GWL_EXSTYLE ) & ~WS_EX_TOPMOST);
-    update_net_wm_states( data );
+    if (data->managed)
+    {
+        SetWindowLongW(hwnd, GWL_EXSTYLE, GetWindowLongW( hwnd, GWL_EXSTYLE ) & ~WS_EX_TOPMOST);
+        update_net_wm_states( data );
+    }
+    release_win_data( data );
 }
 
 static inline RECT get_surface_rect( const RECT *visible_rect )
-- 
1.7.12.3



Подробная информация о списке рассылки Wine-patches