Commit 26e3d2ec authored by Alexandros Frantzis's avatar Alexandros Frantzis Committed by Alexandre Julliard

win32u: Use consistent locking order for display related mutexes.

Most paths that hold both the display_lock and the display_devices_init mutex acquire them in the order just mentioned. However, there are two cases where these are acquired in the opposite order, which with unfortunate thread interactions and timings can lead to a deadlock. Fix these cases to use the same order as the rest of the code.
parent c8bf3ba2
...@@ -1251,8 +1251,8 @@ static void add_gpu( const struct gdi_gpu *gpu, void *param ) ...@@ -1251,8 +1251,8 @@ static void add_gpu( const struct gdi_gpu *gpu, void *param )
if (!ctx->mutex) if (!ctx->mutex)
{ {
ctx->mutex = get_display_device_init_mutex();
pthread_mutex_lock( &display_lock ); pthread_mutex_lock( &display_lock );
ctx->mutex = get_display_device_init_mutex();
prepare_devices(); prepare_devices();
} }
...@@ -1717,8 +1717,8 @@ static BOOL update_display_cache_from_registry(void) ...@@ -1717,8 +1717,8 @@ static BOOL update_display_cache_from_registry(void)
if (key.LastWriteTime.QuadPart <= last_query_display_time) return TRUE; if (key.LastWriteTime.QuadPart <= last_query_display_time) return TRUE;
mutex = get_display_device_init_mutex();
pthread_mutex_lock( &display_lock ); pthread_mutex_lock( &display_lock );
mutex = get_display_device_init_mutex();
clear_display_devices(); clear_display_devices();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment