From: Paul Gofman <pgofman(a)codeweavers.com> This reverts commit 79f3573d8feb638c383c4dff4573ccf711d571af. --- dlls/win32u/sysparams.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/dlls/win32u/sysparams.c b/dlls/win32u/sysparams.c index 9ebd6e26fc4..3211d4e7d8b 100644 --- a/dlls/win32u/sysparams.c +++ b/dlls/win32u/sysparams.c @@ -1485,14 +1485,9 @@ static const struct gdi_device_manager device_manager = add_modes, }; -static void release_display_manager_ctx( struct device_manager_ctx *ctx ) +static void reset_display_manager_ctx( struct device_manager_ctx *ctx ) { - if (ctx->mutex) - { - pthread_mutex_unlock( &display_lock ); - release_display_device_init_mutex( ctx->mutex ); - ctx->mutex = 0; - } + HANDLE mutex = ctx->mutex; if (ctx->source_key) { @@ -1500,6 +1495,20 @@ static void release_display_manager_ctx( struct device_manager_ctx *ctx ) last_query_display_time = 0; } if (ctx->gpu_count) cleanup_devices(); + + memset( ctx, 0, sizeof(*ctx) ); + if ((ctx->mutex = mutex)) prepare_devices(); +} + +static void release_display_manager_ctx( struct device_manager_ctx *ctx ) +{ + if (ctx->mutex) + { + pthread_mutex_unlock( &display_lock ); + release_display_device_init_mutex( ctx->mutex ); + ctx->mutex = 0; + } + reset_display_manager_ctx( ctx ); } static void clear_display_devices(void) -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/4406