From d1ff6e583dcb658e358ee8300715328d53a590be Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Fri, 31 Mar 2023 23:33:42 +0400 Subject: [PATCH] Disable xcb_xlib --- .../platform/linux/specific_linux.cpp | 22 +++++++++++++++++++ Telegram/build/docker/centos_env/Dockerfile | 1 + 2 files changed, 23 insertions(+) diff --git a/Telegram/SourceFiles/platform/linux/specific_linux.cpp b/Telegram/SourceFiles/platform/linux/specific_linux.cpp index 6d98b39fe..2a78d1cc5 100644 --- a/Telegram/SourceFiles/platform/linux/specific_linux.cpp +++ b/Telegram/SourceFiles/platform/linux/specific_linux.cpp @@ -54,12 +54,20 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include #include #include +#include #include using namespace Platform; using Platform::internal::WaylandIntegration; +#ifndef DESKTOP_APP_DISABLE_X11_INTEGRATION +typedef struct _XDisplay Display; +struct XErrorEvent; +typedef int (*XErrorHandler)(Display*, XErrorEvent*); +typedef XErrorHandler (*LPXSETERRORHANDLER)(XErrorHandler); +#endif // !DESKTOP_APP_DISABLE_X11_INTEGRATION + #ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION typedef GApplication TDesktopApplication; typedef GApplicationClass TDesktopApplicationClass; @@ -877,6 +885,20 @@ void start() { LOG(("Icon theme: %1").arg(QIcon::themeName())); LOG(("Fallback icon theme: %1").arg(QIcon::fallbackThemeName())); +#ifndef DESKTOP_APP_DISABLE_X11_INTEGRATION + // tdesktop doesn't use xlib by itself, + // but some libraries it depends on may do + const auto XSetErrorHandler = reinterpret_cast( + dlsym(RTLD_DEFAULT, "XSetErrorHandler")); + + // Reset errors if any + (void) dlerror(); + + if (XSetErrorHandler) { + XSetErrorHandler([](Display *dpy, XErrorEvent *err) { return 0; }); + } +#endif // !DESKTOP_APP_DISABLE_X11_INTEGRATION + #ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION InstallLauncher(); LaunchGApplication(); diff --git a/Telegram/build/docker/centos_env/Dockerfile b/Telegram/build/docker/centos_env/Dockerfile index fba81a97f..254ae38aa 100644 --- a/Telegram/build/docker/centos_env/Dockerfile +++ b/Telegram/build/docker/centos_env/Dockerfile @@ -734,6 +734,7 @@ RUN git clone -b {{ QT_TAG }} --depth=1 git://code.qt.io/qt/qt5.git qt_{{ QT }} -qt-harfbuzz \ -qt-pcre \ -no-icu \ + -no-feature-xcb-xlib \ -no-feature-xcb-sm \ -no-feature-egl-extension-platform-wayland \ -static \