From 6f6f704fcfe261e33b5d448abb8bc4f38bc46d87 Mon Sep 17 00:00:00 2001 From: Olivier Bilodeau Date: Tue, 20 Dec 2022 11:17:00 -0500 Subject: [PATCH] Fixed QT segmentation fault in QBitmap.fromData in GlyphEntry (#428) It's a weird fix but other attempts lead to video corruption see ticket for details. Tests started failing in CI so the QT_QPA_PLATFORM environment variable trick was required to avoid that. --- bin/pyrdp-convert.py | 4 ++++ test/integration.sh | 2 ++ 2 files changed, 6 insertions(+) diff --git a/bin/pyrdp-convert.py b/bin/pyrdp-convert.py index b87b80bb9..67d073243 100755 --- a/bin/pyrdp-convert.py +++ b/bin/pyrdp-convert.py @@ -63,6 +63,10 @@ if not HAS_GUI and args.format == "mp4": sys.stderr.write("Error: MP4 conversion requires the full PyRDP installation.") sys.exit(1) + elif HAS_GUI and args.format == "mp4": + # Initialize QT because QBitmap will segfault without it (#378, #428) + from PySide2.QtWidgets import QApplication + app = QApplication() logging.basicConfig(level=logging.CRITICAL) logging.getLogger("scapy").setLevel(logging.ERROR) diff --git a/test/integration.sh b/test/integration.sh index 647ac2640..8f9ea2c04 100755 --- a/test/integration.sh +++ b/test/integration.sh @@ -21,6 +21,8 @@ else PREPEND="coverage run --append bin/" fi +export QT_QPA_PLATFORM=offscreen + echo =================================================== echo pyrdp-player.py read a replay in headless mode test ${PREPEND}pyrdp-player.py --headless test/files/test_session.replay