We won't be able to do it later on otherwise as get_dc_ptr will fail with a disabled DC, and release_dce will then not clear the drawable.
This will delay the drawable release until the dce is later reused, for instance for a different window, which may cause a complicated deadlock.
From: Rémi Bernon rbernon@codeweavers.com
We won't be able to do it later on otherwise as get_dc_ptr will fail with a disabled DC, and release_dce will then not clear the drawable.
This will delay the drawable release until the dce is later reused, for instance for a different window, which may cause a complicated deadlock. --- dlls/win32u/dce.c | 1 + dlls/win32u/win32u_private.h | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/dlls/win32u/dce.c b/dlls/win32u/dce.c index 29f11e18256..d1cf5c78bab 100644 --- a/dlls/win32u/dce.c +++ b/dlls/win32u/dce.c @@ -1224,6 +1224,7 @@ static INT release_dc( HWND hwnd, HDC hdc, BOOL end_paint ) if (end_paint || (dce->flags & DCX_CACHE)) delete_clip_rgn( dce ); if (dce->flags & DCX_CACHE) { + set_dc_opengl_drawable( dce->hdc, NULL ); dce->count = 0; set_dce_flags( dce->hdc, DCHF_DISABLEDC ); } diff --git a/dlls/win32u/win32u_private.h b/dlls/win32u/win32u_private.h index 780e8cd26cc..e683f7cd824 100644 --- a/dlls/win32u/win32u_private.h +++ b/dlls/win32u/win32u_private.h @@ -193,7 +193,7 @@ extern void user_check_not_lock(void); /* opengl.c */
struct opengl_drawable; -void set_dc_opengl_drawable( HDC hdc, struct opengl_drawable *new_drawable ); +extern void set_dc_opengl_drawable( HDC hdc, struct opengl_drawable *new_drawable );
/* d3dkmtc. */
@huw I'm not sure this is the best way to fix this. Another option is to use `get_dc_obj` instead of `get_dc_ptr` to access the DC object in `get_dc_opengl_drawable`/`set_dc_opengl_drawable`, but the function is static and I felt that exporting it would make things more confusing. I could also move the `dc_opengl` functions to dc.c, though I would prefer to keep GL stuff together.
Note that I'm also a bit lost in the DC/dce logic, their lifetime, and how they get reused. Using them to hold the GL surfaces was a convenient way to replace the drivers DC/surface tracking but it's maybe not the best way.