[PATCH] winex11.drv: Remove active client window from window data before deleting it.
Paul Gofman
pgofman at codeweavers.com
Wed Aug 5 15:26:55 CDT 2020
Fixes a crash with BadDrawable X error which happens when client window is used
in windows.c:sync_client_position() after the GL drawable has been deleted.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=49649
Signed-off-by: Paul Gofman <pgofman at codeweavers.com>
---
dlls/winex11.drv/opengl.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c
index 4a3ab31273a..a2ec8bd0c91 100644
--- a/dlls/winex11.drv/opengl.c
+++ b/dlls/winex11.drv/opengl.c
@@ -240,6 +240,7 @@ enum dc_gl_type
struct gl_drawable
{
LONG ref; /* reference count */
+ HWND hwnd;
enum dc_gl_type type; /* type of GL surface */
GLXDrawable drawable; /* drawable for rendering with GL */
Window window; /* window if drawable is a GLXWindow */
@@ -1162,10 +1163,23 @@ static void release_gl_drawable( struct gl_drawable *gl )
{
case DC_GL_WINDOW:
case DC_GL_CHILD_WIN:
+ {
+ struct x11drv_win_data *data = get_win_data( gl->hwnd );
+
TRACE( "destroying %lx drawable %lx\n", gl->window, gl->drawable );
+ if (data)
+ {
+ if (data->client_window == gl->window)
+ {
+ XDeleteContext( data->display, data->client_window, winContext );
+ data->client_window = 0;
+ }
+ release_win_data( data );
+ }
pglXDestroyWindow( gdi_display, gl->drawable );
XDestroyWindow( gdi_display, gl->window );
break;
+ }
case DC_GL_PIXMAP_WIN:
TRACE( "destroying pixmap %lx drawable %lx\n", gl->pixmap, gl->drawable );
pglXDestroyPixmap( gdi_display, gl->drawable );
@@ -1321,6 +1335,7 @@ static struct gl_drawable *create_gl_drawable( HWND hwnd, const struct wgl_pixel
/* Default GLX and WGL swap interval is 1, but in case of glXSwapIntervalSGI
* there is no way to query it, so we have to store it here.
*/
+ gl->hwnd = hwnd;
gl->swap_interval = 1;
gl->refresh_swap_interval = TRUE;
gl->format = format;
--
2.26.2
More information about the wine-devel
mailing list