summaryrefslogtreecommitdiffhomepage
path: root/gui/init.cpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2019-01-07 11:28:35 +0100
committerStanislaw Halik <sthalik@misaki.pl>2019-01-16 07:48:46 +0100
commitfd3eb4515639e000b899544827b5fd4ff9473937 (patch)
tree0a9ee3050034db0b841d48d35810f8d28bfeb35f /gui/init.cpp
parentba798bf5f69a55973abf9af85bbe6aaf30c24f98 (diff)
gui/init: call XInitThreads(3)
The Qt function for enable X11 threads is obsolete given it fully uses Xcb. We're using some Xlib calls in qxt-mini in places. Call it manually rather than risking arbitrary crashes.
Diffstat (limited to 'gui/init.cpp')
-rw-r--r--gui/init.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/gui/init.cpp b/gui/init.cpp
index 9cb32e2c..04334782 100644
--- a/gui/init.cpp
+++ b/gui/init.cpp
@@ -71,6 +71,14 @@ static void set_fp_mask()
#endif
}
+#ifdef OTR_X11_THREADS
+#include <X11/Xlib.h>
+static void enable_x11_threads()
+{
+ (void)XInitThreads();
+}
+#endif
+
static void set_qt_style()
{
#if defined _WIN32 || defined __APPLE__
@@ -237,6 +245,9 @@ static int run_window(std::unique_ptr<QWidget> main_window)
int otr_main(int argc, char** argv, std::function<QWidget*()> const& make_main_window)
{
set_fp_mask();
+#ifdef OTR_X11_THREADS
+ enable_x11_threads();
+#endif
#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);