From c561679bd476b06e718e2c2b3148962404f1d002 Mon Sep 17 00:00:00 2001 From: Camila Ayres Date: Thu, 19 Dec 2024 15:07:13 +0100 Subject: [PATCH] Detect if it is running in a Vmware or being access via RDP to disable graphic acceleration. There has been reports of the client crashing in a VMware or being accessed via RDP starting with 3.15.0 due to the client's use of graphic acceleration. Signed-off-by: Camila Ayres --- src/gui/application.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/gui/application.cpp b/src/gui/application.cpp index 4175ae5f0649b..e1e6b89df8e80 100644 --- a/src/gui/application.cpp +++ b/src/gui/application.cpp @@ -224,6 +224,24 @@ Application::Application(int &argc, char **argv) // Ensure OpenSSL config file is only loaded from app directory QString opensslConf = QCoreApplication::applicationDirPath() + QStringLiteral("/openssl.cnf"); qputenv("OPENSSL_CONF", opensslConf.toLocal8Bit()); + + const auto shouldDisableGraphicsAcceleration = [&]() { + const auto systemEnvironment = QProcessEnvironment::systemEnvironment(); + if (systemEnvironment.contains(QStringLiteral("VMWARE"))) { + return true; + } + + if (systemEnvironment.contains("SESSIONNAME") && systemEnvironment.value("SESSIONNAME").startsWith("RDP-")) { + return true; + } + + return false; + }; + + if (shouldDisableGraphicsAcceleration()) { + QProcessEnvironment::systemEnvironment().insert(QStringLiteral("SVGA_ALLOW_LLVMPIPE"), 0); + qCInfo(lcApplication) << "Disabling graphics acceleration, application might be running in a virtual or in a remote desktop."; + } #endif // TODO: Can't set this without breaking current config paths