mirror of https://github.com/FreeRDP/FreeRDP
[client,sdl] lock connection dialog access
might happen from different threads.
This commit is contained in:
parent
3bdaca81d0
commit
23f8fd2fee
|
@ -214,6 +214,7 @@ SSIZE_T sdl_retry_dialog(freerdp* instance, const char* what, size_t current, vo
|
|||
WINPR_ASSERT(what);
|
||||
|
||||
auto sdl = get_context(instance->context);
|
||||
std::lock_guard<CriticalSection> lock(sdl->critical);
|
||||
WINPR_ASSERT(sdl->connection_dialog);
|
||||
|
||||
sdl->connection_dialog->setTitle("Retry connection to %s",
|
||||
|
|
|
@ -49,7 +49,8 @@ SdlWidget::SdlWidget(SDL_Renderer* renderer, const SDL_Rect& rect, bool input)
|
|||
else
|
||||
{
|
||||
_font = TTF_OpenFontRW(ops, 1, 64);
|
||||
widget_log_error(-1, "TTF_OpenFontRW");
|
||||
if (!_font)
|
||||
widget_log_error(-1, "TTF_OpenFontRW");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -598,6 +598,7 @@ static BOOL sdl_pre_connect(freerdp* instance)
|
|||
if (!sdl_wait_for_init(sdl))
|
||||
return FALSE;
|
||||
|
||||
std::lock_guard<CriticalSection> lock(sdl->critical);
|
||||
sdl->connection_dialog.reset(new SDLConnectionDialog(instance->context));
|
||||
|
||||
sdl->connection_dialog->setTitle("Connecting to '%s'",
|
||||
|
@ -1104,6 +1105,7 @@ static BOOL sdl_post_connect(freerdp* instance)
|
|||
auto sdl = get_context(context);
|
||||
|
||||
// Retry was successful, discard dialog
|
||||
std::lock_guard<CriticalSection> lock(sdl->critical);
|
||||
if (sdl->connection_dialog)
|
||||
sdl->connection_dialog->hide();
|
||||
|
||||
|
@ -1176,6 +1178,7 @@ static void sdl_post_final_disconnect(freerdp* instance)
|
|||
|
||||
auto context = get_context(instance->context);
|
||||
|
||||
std::lock_guard<CriticalSection> lock(context->critical);
|
||||
if (context->connection_dialog)
|
||||
context->connection_dialog->wait(true);
|
||||
context->connection_dialog.reset();
|
||||
|
|
Loading…
Reference in New Issue