From: Rémi Bernon rbernon@codeweavers.com
--- dlls/win32u/sysparams.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-)
diff --git a/dlls/win32u/sysparams.c b/dlls/win32u/sysparams.c index 729effa841b..b7fe67f65c5 100644 --- a/dlls/win32u/sysparams.c +++ b/dlls/win32u/sysparams.c @@ -926,10 +926,10 @@ static unsigned int format_date( WCHAR *bufferW, LONGLONG time ) struct device_manager_ctx { UINT gpu_count; + struct list gpus; UINT source_count; UINT monitor_count; HANDLE mutex; - struct gpu *gpu; struct source source; HKEY source_key; /* for the virtual desktop settings */ @@ -1262,8 +1262,7 @@ static void add_gpu( const char *name, const struct pci_id *pci_id, const GUID * WARN( "Failed to write gpu to registry\n" ); else { - if (ctx->gpu) gpu_release( ctx->gpu ); - ctx->gpu = gpu; + list_add_tail( &ctx->gpus, &gpu->entry ); ctx->gpu_count++; } } @@ -1313,7 +1312,7 @@ static BOOL write_source_to_registry( const struct source *source, HKEY *source_ static void add_source( const char *name, UINT state_flags, void *param ) { struct device_manager_ctx *ctx = param; - struct gpu *gpu = ctx->gpu; + struct gpu *gpu = LIST_ENTRY( list_tail( &ctx->gpus ), struct gpu, entry );
TRACE( "name %s, state_flags %#x\n", name, state_flags );
@@ -1499,7 +1498,12 @@ static void release_display_manager_ctx( struct device_manager_ctx *ctx ) } if (ctx->gpu_count) cleanup_devices();
- gpu_release( ctx->gpu ); + while (!list_empty( &ctx->gpus )) + { + struct gpu *gpu = LIST_ENTRY( list_head( &ctx->gpus ), struct gpu, entry ); + list_remove( &gpu->entry ); + gpu_release( gpu ); + } }
static void clear_display_devices(void) @@ -1886,7 +1890,7 @@ static void add_virtual_modes( struct device_manager_ctx *ctx, const DEVMODEW *c static BOOL add_virtual_source( struct device_manager_ctx *ctx ) { DEVMODEW current, initial = ctx->primary, maximum = ctx->primary; - struct gpu *gpu = ctx->gpu; + struct gpu *gpu = LIST_ENTRY( list_tail( &ctx->gpus ), struct gpu, entry ); struct source virtual_source = { .state_flags = DISPLAY_DEVICE_ATTACHED_TO_DESKTOP | DISPLAY_DEVICE_PRIMARY_DEVICE | DISPLAY_DEVICE_VGA_COMPATIBLE, @@ -1952,7 +1956,7 @@ BOOL update_display_cache( BOOL force ) static const WCHAR wine_service_station_name[] = {'_','_','w','i','n','e','s','e','r','v','i','c','e','_','w','i','n','s','t','a','t','i','o','n',0}; HWINSTA winstation = NtUserGetProcessWindowStation(); - struct device_manager_ctx ctx = {0}; + struct device_manager_ctx ctx = {.gpus = LIST_INIT(ctx.gpus)}; UINT status; WCHAR name[MAX_PATH];