[PATCH 0/1] MR9801: winex11: Avoid creating window data entirely for offscreen windows.
This fixes a series of unfortunate changes made in 844e90b0b51c799bed68320940b51bda74ac275c b621117c652280799e209d5bec20106b1f28cb4e, which started causing various behavior changes as the (foreign / message) client window creation now triggers window data to be created, and even worse, with a whole_window set. This first makes these client windows to always be created attached to their whole window instead of the dummy parent, and, the be managed more like normal client windows and eventually detached / attached by reparenting them to / from the dummy parent. The actual issue, which started somehow after 92f5d5bc7c8412924e7cb4f6f715ecc9c4e4dd13, is that the client windows are created from an arbitrary thread, when D3D sets its internal pixel format, and this thread display is initialized and used and stored in the newly created window data. The client window lifetime is not bound to this particular thread, and it may outlive the thread itself. We then keep using a destroyed display for the reparenting calls, which is causing crashes. Using a dummy window data is enough for the client window creation to succeed and the client window will always stay attached to the dummy parent. As we don't create window data anymore, get_win_data will never succeed and we will never assume these client windows are from the current process. X11DRV_get_whole_window will works still, as we need it in some cases, but retrieving the toplevel X11 window from the window property instead. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/9801
From: Rémi Bernon <rbernon@codeweavers.com> --- dlls/winex11.drv/window.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c index e5cf1c90080..9fbcf5c92ed 100644 --- a/dlls/winex11.drv/window.c +++ b/dlls/winex11.drv/window.c @@ -2338,19 +2338,12 @@ void destroy_client_window( HWND hwnd, Window client_window ) */ Window create_client_window( HWND hwnd, RECT client_rect, const XVisualInfo *visual, Colormap colormap ) { - struct x11drv_win_data *data = get_win_data( hwnd ); + struct x11drv_win_data *data = get_win_data( hwnd ), dummy = {0}; XSetWindowAttributes attr; Window ret; int x, y, cx, cy; - if (!data) - { - Window toplevel = X11DRV_get_whole_window( hwnd ); - /* explicitly create data for HWND_MESSAGE and foreign windows since they can be used for OpenGL */ - if (!(data = alloc_win_data( thread_init_display(), hwnd ))) return 0; - data->rects.window = data->rects.visible = data->rects.client = client_rect; - data->whole_window = toplevel; - } + if (!data) data = &dummy; /* use a dummy window data for HWND_MESSAGE and foreign windows, to create an offscreen client window */ detach_client_window( data, data->client_window ); @@ -2381,7 +2374,8 @@ Window create_client_window( HWND hwnd, RECT client_rect, const XVisualInfo *vis } TRACE( "%p xwin %lx/%lx\n", data->hwnd, data->whole_window, data->client_window ); } - release_win_data( data ); + + if (data != &dummy) release_win_data( data ); return ret; } -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/9801
participants (2)
-
Rémi Bernon -
Rémi Bernon (@rbernon)