[client,sdl] unique_ptr for display channel

This commit is contained in:
Armin Novak 2023-05-30 20:31:46 +02:00 committed by Martin Fleisz
parent 324e8c7813
commit 1a74d832de
3 changed files with 6 additions and 6 deletions

View File

@ -145,7 +145,7 @@ static BOOL sdl_disp_check_context(void* context, sdlContext** ppsdl, sdlDispCon
return FALSE;
*ppsdl = sdl;
*ppsdlDisp = sdl->disp;
*ppsdlDisp = sdl->disp.get();
*ppSettings = sdl->common.context.settings;
return TRUE;
}

View File

@ -908,7 +908,7 @@ static BOOL sdl_post_connect(freerdp* instance)
if (!sdl_create_primary(sdl))
return FALSE;
sdl->disp = new sdlDispContext(sdl);
sdl->disp = std::make_unique<sdlDispContext>(sdl);
if (!sdl->disp)
return FALSE;
@ -963,9 +963,7 @@ static void sdl_post_final_disconnect(freerdp* instance)
return;
auto context = reinterpret_cast<sdlContext*>(instance->context);
delete (context->disp);
context->disp = nullptr;
context->disp.reset();
delete context->input;
context->input = nullptr;

View File

@ -19,6 +19,8 @@
#pragma once
#include <memory>
#include <freerdp/freerdp.h>
#include <freerdp/client/rdpei.h>
#include <freerdp/client/rail.h>
@ -64,7 +66,7 @@ struct sdl_context
SDL_Surface* primary;
SDL_PixelFormat* primary_format;
sdlDispContext* disp;
std::unique_ptr<sdlDispContext> disp;
sdlInput* input;
Uint32 sdl_pixel_format;