mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-04-01 23:00:58 +00:00
Don't load another gtk version if gtk_init_check was called
This commit is contained in:
parent
f697abe9a1
commit
d319c85c57
@ -20,6 +20,8 @@ namespace Platform {
|
|||||||
namespace Libs {
|
namespace Libs {
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
bool gtkTriedToInit = false;
|
||||||
|
|
||||||
bool loadLibrary(QLibrary &lib, const char *name, int version) {
|
bool loadLibrary(QLibrary &lib, const char *name, int version) {
|
||||||
DEBUG_LOG(("Loading '%1' with version %2...").arg(QLatin1String(name)).arg(version));
|
DEBUG_LOG(("Loading '%1' with version %2...").arg(QLatin1String(name)).arg(version));
|
||||||
lib.setFileNameAndVersion(QLatin1String(name), version);
|
lib.setFileNameAndVersion(QLatin1String(name), version);
|
||||||
@ -153,6 +155,7 @@ bool setupGtkBase(QLibrary &lib_gtk) {
|
|||||||
int (*oldErrorHandler)(Display *, XErrorEvent *) = XSetErrorHandler(nullptr);
|
int (*oldErrorHandler)(Display *, XErrorEvent *) = XSetErrorHandler(nullptr);
|
||||||
|
|
||||||
DEBUG_LOG(("Library gtk functions loaded!"));
|
DEBUG_LOG(("Library gtk functions loaded!"));
|
||||||
|
gtkTriedToInit = true;
|
||||||
if (!gtk_init_check(0, 0)) {
|
if (!gtk_init_check(0, 0)) {
|
||||||
gtk_init_check = nullptr;
|
gtk_init_check = nullptr;
|
||||||
DEBUG_LOG(("Failed to gtk_init_check(0, 0)!"));
|
DEBUG_LOG(("Failed to gtk_init_check(0, 0)!"));
|
||||||
@ -253,7 +256,7 @@ void start() {
|
|||||||
if (loadLibrary(lib_gtk, "gtk-3", 0)) {
|
if (loadLibrary(lib_gtk, "gtk-3", 0)) {
|
||||||
gtkLoaded = setupGtkBase(lib_gtk);
|
gtkLoaded = setupGtkBase(lib_gtk);
|
||||||
}
|
}
|
||||||
if (!gtkLoaded && loadLibrary(lib_gtk, "gtk-x11-2.0", 0)) {
|
if (!gtkLoaded && !gtkTriedToInit && loadLibrary(lib_gtk, "gtk-x11-2.0", 0)) {
|
||||||
gtkLoaded = setupGtkBase(lib_gtk);
|
gtkLoaded = setupGtkBase(lib_gtk);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user