[client,sdl] lock primary while used

This commit is contained in:
akallabeth
2025-12-31 15:43:12 +01:00
parent c477869bf7
commit 98deec9ec0

View File

@@ -364,6 +364,7 @@ static BOOL sdl_draw_to_window(SdlContext* sdl, SdlWindow& window,
auto size = window.rect();
std::unique_lock lock(sdl->critical);
auto surface = sdl->primary.get();
if (freerdp_settings_get_bool(context->settings, FreeRDP_SmartSizing))
{
@@ -495,7 +496,7 @@ static BOOL sdl_desktop_resize(rdpContext* context)
settings = context->settings;
WINPR_ASSERT(settings);
std::scoped_lock lock(sdl->critical);
std::unique_lock lock(sdl->critical);
gdi = context->gdi;
if (!gdi_resize(gdi, freerdp_settings_get_uint32(settings, FreeRDP_DesktopWidth),
freerdp_settings_get_uint32(settings, FreeRDP_DesktopHeight)))
@@ -644,7 +645,7 @@ static void sdl_cleanup_sdl(SdlContext* sdl)
if (!sdl)
return;
std::scoped_lock lock(sdl->critical);
std::unique_lock lock(sdl->critical);
sdl->windows.clear();
sdl->dialog.destroy();
@@ -763,7 +764,7 @@ static BOOL sdl_wait_create_windows(SdlContext* sdl)
static bool shall_abort(SdlContext* sdl)
{
std::scoped_lock lock(sdl->critical);
std::unique_lock lock(sdl->critical);
if (freerdp_shall_disconnect_context(sdl->context()))
{
if (sdl->rdp_thread_running)
@@ -833,7 +834,7 @@ static int sdl_run(SdlContext* sdl)
sdl_event_type_str(windowEvent.type), windowEvent.type);
#endif
{
std::scoped_lock lock(sdl->critical);
std::unique_lock lock(sdl->critical);
/* The session might have been disconnected while we were waiting for a
* new SDL event. In that case ignore the SDL event and terminate. */
if (freerdp_shall_disconnect_context(sdl->context()))