From: Rémi Bernon rbernon@codeweavers.com
--- dlls/win32u/sysparams.c | 72 +++++++++++++++++++++-------------------- 1 file changed, 37 insertions(+), 35 deletions(-)
diff --git a/dlls/win32u/sysparams.c b/dlls/win32u/sysparams.c index f16934887a7..f42527a10a0 100644 --- a/dlls/win32u/sysparams.c +++ b/dlls/win32u/sysparams.c @@ -745,6 +745,41 @@ static void reg_empty_key( HKEY root, const char *key_name ) if (hkey != root) NtClose( hkey ); }
+static void clear_display_devices(void) +{ + struct source *source; + struct monitor *monitor; + struct gpu *gpu; + + if (list_head( &monitors ) == &virtual_monitor.entry) + { + list_init( &monitors ); + return; + } + + while (!list_empty( &monitors )) + { + monitor = LIST_ENTRY( list_head( &monitors ), struct monitor, entry ); + if (monitor->source) source_release( monitor->source ); + list_remove( &monitor->entry ); + free( monitor ); + } + + while (!list_empty( &sources )) + { + source = LIST_ENTRY( list_head( &sources ), struct source, entry ); + list_remove( &source->entry ); + source_release( source ); + } + + while (!list_empty( &gpus )) + { + gpu = LIST_ENTRY( list_head( &gpus ), struct gpu, entry ); + list_remove( &gpu->entry ); + gpu_release( gpu ); + } +} + static void prepare_devices(void) { char buffer[4096]; @@ -755,6 +790,8 @@ static void prepare_devices(void) DWORD size; HKEY hkey, subkey, device_key, prop_key;
+ clear_display_devices(); + if (!enum_key) enum_key = reg_create_ascii_key( NULL, enum_keyA, 0, NULL ); if (!control_key) control_key = reg_create_ascii_key( NULL, control_keyA, 0, NULL ); if (!video_key) video_key = reg_create_ascii_key( NULL, devicemap_video_keyA, REG_OPTION_VOLATILE, NULL ); @@ -1647,41 +1684,6 @@ static void release_display_manager_ctx( struct device_manager_ctx *ctx ) } }
-static void clear_display_devices(void) -{ - struct source *source; - struct monitor *monitor; - struct gpu *gpu; - - if (list_head( &monitors ) == &virtual_monitor.entry) - { - list_init( &monitors ); - return; - } - - while (!list_empty( &monitors )) - { - monitor = LIST_ENTRY( list_head( &monitors ), struct monitor, entry ); - if (monitor->source) source_release( monitor->source ); - list_remove( &monitor->entry ); - free( monitor ); - } - - while (!list_empty( &sources )) - { - source = LIST_ENTRY( list_head( &sources ), struct source, entry ); - list_remove( &source->entry ); - source_release( source ); - } - - while (!list_empty( &gpus )) - { - gpu = LIST_ENTRY( list_head( &gpus ), struct gpu, entry ); - list_remove( &gpu->entry ); - gpu_release( gpu ); - } -} - static BOOL is_detached_mode( const DEVMODEW *mode ) { return mode->dmFields & DM_POSITION &&