2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-09-01 07:05:13 +00:00

Version 1.0.27: Fix launch in Ubuntu 17.04

Ubuntu 17.04 launch results in segfault if the build was done
by GCC 6.2 (works fine with GCC 4.9). Backtrace shows that it
crashes in gtk_init_check() call somewhere in libmirclient and
tests show that it works fine with GDK_BACKEND=x11.

So we use gdk_set_allowed_backends() method to explicitly state
that we support only "x11" GDK backend, that way it doesn't try
to use libmirclient and it does not crash.

Fix #3176 #3162
This commit is contained in:
John Preston
2017-03-31 13:34:30 +03:00
parent df6972eeba
commit 8884cb190a
8 changed files with 39 additions and 19 deletions

View File

@@ -111,6 +111,17 @@ bool setupGtkBase(QLibrary &lib_gtk) {
if (!load(lib_gtk, "g_error_free", g_error_free)) return false;
if (!load(lib_gtk, "g_slist_free", g_slist_free)) return false;
DEBUG_LOG(("Library gtk functions loaded!"));
if (load(lib_gtk, "gdk_set_allowed_backends", gdk_set_allowed_backends)) {
// We work only with X11 GDK backend.
// Otherwise we get segfault in Ubuntu 17.04 in gtk_init_check() call.
// See https://github.com/telegramdesktop/tdesktop/issues/3176
// See https://github.com/telegramdesktop/tdesktop/issues/3162
DEBUG_LOG(("Limit allowed GDK backends to x11"));
gdk_set_allowed_backends("x11");
}
DEBUG_LOG(("Library gtk functions loaded!"));
if (!gtk_init_check(0, 0)) {
gtk_init_check = nullptr;
@@ -181,6 +192,7 @@ f_gtk_image_set_from_pixbuf gtk_image_set_from_pixbuf = nullptr;
f_gtk_dialog_get_widget_for_response gtk_dialog_get_widget_for_response = nullptr;
f_gtk_button_set_label gtk_button_set_label = nullptr;
f_gtk_button_get_type gtk_button_get_type = nullptr;
f_gdk_set_allowed_backends gdk_set_allowed_backends = nullptr;
f_gdk_window_set_modal_hint gdk_window_set_modal_hint = nullptr;
f_gdk_window_focus gdk_window_focus = nullptr;
f_gtk_dialog_get_type gtk_dialog_get_type = nullptr;