From 64720224ebbeb793d10264c38a92bb0f2bfdebcb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Blin?=
 <sebastien.blin@savoirfairelinux.com>
Date: Thu, 3 Jun 2021 17:07:52 -0400
Subject: [PATCH] qtwebengine: fix loading fonts on recent glibc

QtWebEngine can't load fonts on recent glibc. Source:
https://bugreports.qt.io/browse/QTBUG-92969
https://bugs.chromium.org/p/chromium/issues/detail?id=1164975

I don't want to have custom patched Qt version running for Jami,
so, for now disable sandboxing to fix font loading and wait for a
fixed Qt version.

GitLab: #442
Change-Id: Ia0918b6c47dc8a9bcfed8556043b5163e4963248
---
 src/main.cpp | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/main.cpp b/src/main.cpp
index f73fdbfd6..f0e3cd973 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -53,6 +53,14 @@ main(int argc, char* argv[])
     setlocale(LC_ALL, "en_US.utf8");
 #ifdef Q_OS_LINUX
     setenv("QT_QPA_PLATFORMTHEME", "gtk3", true);
+#ifdef __GLIBC__
+    // Current glibc is causing some bugs with font loading
+    // See https://bugreports.qt.io/browse/QTBUG-92969
+    // As I prefer to not use custom patched Qt, just wait for a
+    // new version with this bug fixed
+    if (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 33))
+        setenv("QTWEBENGINE_CHROMIUM_FLAGS", "--no-sandbox", true);
+#endif
 #endif
     QApplication::setApplicationName("Jami");
     QApplication::setOrganizationDomain("jami.net");
-- 
GitLab