File: client-sdl-only-draw-to-window-if-connected.patch

package info (click to toggle)
freerdp3 3.15.0%2Bdfsg-2.1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 67,600 kB
  • sloc: ansic: 407,832; cpp: 18,513; xml: 1,721; python: 1,155; sh: 758; lisp: 408; perl: 231; cs: 191; makefile: 104
file content (38 lines) | stat: -rw-r--r-- 1,249 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
Origin: upstream, https://github.com/FreeRDP/FreeRDP/commit/ce8fc4e0f41efc55cf26e82fafce6f23e1dac2af
Forwarded: not-needed
From: Armin Novak <armin.novak@thincast.com>
Date: Tue, 15 Apr 2025 10:13:52 +0200
Subject: [client,sdl] only draw to window if connected

---
 client/SDL/SDL3/sdl_freerdp.cpp | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/client/SDL/SDL3/sdl_freerdp.cpp b/client/SDL/SDL3/sdl_freerdp.cpp
index 554529880..96251e032 100644
--- a/client/SDL/SDL3/sdl_freerdp.cpp
+++ b/client/SDL/SDL3/sdl_freerdp.cpp
@@ -295,6 +295,7 @@ static BOOL sdl_begin_paint(rdpContext* context)
 static bool sdl_draw_to_window_rect([[maybe_unused]] SdlContext* sdl, SdlWindow& window,
                                     SDL_Surface* surface, SDL_Point offset, const SDL_Rect& srcRect)
 {
+	WINPR_ASSERT(surface);
 	SDL_Rect dstRect = { offset.x + srcRect.x, offset.y + srcRect.y, srcRect.w, srcRect.h };
 	return window.blit(surface, srcRect, dstRect);
 }
@@ -345,8 +346,12 @@ static BOOL sdl_draw_to_window(SdlContext* sdl, SdlWindow& window,
 {
 	WINPR_ASSERT(sdl);
 
+	if (!sdl->isConnected())
+		return TRUE;
+
 	auto context = sdl->context();
 	auto gdi = context->gdi;
+	WINPR_ASSERT(gdi);
 
 	auto size = window.rect();
 
-- 
2.39.5