From 8884cb190aec02bf3cfc5a8fae74de18aebdb230 Mon Sep 17 00:00:00 2001 From: John Preston Date: Fri, 31 Mar 2017 13:34:30 +0300 Subject: [PATCH] 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 --- Telegram/Resources/uwp/AppX/AppxManifest.xml | 2 +- Telegram/Resources/winrc/Telegram.rc | 8 ++++---- Telegram/Resources/winrc/Updater.rc | 8 ++++---- Telegram/SourceFiles/core/version.h | 4 ++-- Telegram/SourceFiles/platform/linux/linux_libs.cpp | 12 ++++++++++++ Telegram/SourceFiles/platform/linux/linux_libs.h | 13 ++++++++----- Telegram/build/version | 6 +++--- changelog.txt | 5 +++++ 8 files changed, 39 insertions(+), 19 deletions(-) diff --git a/Telegram/Resources/uwp/AppX/AppxManifest.xml b/Telegram/Resources/uwp/AppX/AppxManifest.xml index 0066e599ec..7a63488478 100644 --- a/Telegram/Resources/uwp/AppX/AppxManifest.xml +++ b/Telegram/Resources/uwp/AppX/AppxManifest.xml @@ -9,7 +9,7 @@ + Version="1.0.27.0" /> Telegram Desktop Telegram Messenger LLP diff --git a/Telegram/Resources/winrc/Telegram.rc b/Telegram/Resources/winrc/Telegram.rc index b4c89ac7c5..94f65369fd 100644 --- a/Telegram/Resources/winrc/Telegram.rc +++ b/Telegram/Resources/winrc/Telegram.rc @@ -34,8 +34,8 @@ IDI_ICON1 ICON "..\\art\\icon256.ico" // VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,0,26,0 - PRODUCTVERSION 1,0,26,0 + FILEVERSION 1,0,27,0 + PRODUCTVERSION 1,0,27,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -52,10 +52,10 @@ BEGIN BEGIN VALUE "CompanyName", "Telegram Messenger LLP" VALUE "FileDescription", "Telegram Desktop" - VALUE "FileVersion", "1.0.26.0" + VALUE "FileVersion", "1.0.27.0" VALUE "LegalCopyright", "Copyright (C) 2014-2017" VALUE "ProductName", "Telegram Desktop" - VALUE "ProductVersion", "1.0.26.0" + VALUE "ProductVersion", "1.0.27.0" END END BLOCK "VarFileInfo" diff --git a/Telegram/Resources/winrc/Updater.rc b/Telegram/Resources/winrc/Updater.rc index 36e4ad5af6..3f22ff911a 100644 --- a/Telegram/Resources/winrc/Updater.rc +++ b/Telegram/Resources/winrc/Updater.rc @@ -25,8 +25,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US // VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,0,26,0 - PRODUCTVERSION 1,0,26,0 + FILEVERSION 1,0,27,0 + PRODUCTVERSION 1,0,27,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -43,10 +43,10 @@ BEGIN BEGIN VALUE "CompanyName", "Telegram Messenger LLP" VALUE "FileDescription", "Telegram Desktop Updater" - VALUE "FileVersion", "1.0.26.0" + VALUE "FileVersion", "1.0.27.0" VALUE "LegalCopyright", "Copyright (C) 2014-2017" VALUE "ProductName", "Telegram Desktop" - VALUE "ProductVersion", "1.0.26.0" + VALUE "ProductVersion", "1.0.27.0" END END BLOCK "VarFileInfo" diff --git a/Telegram/SourceFiles/core/version.h b/Telegram/SourceFiles/core/version.h index e341f8bb36..2dbdf1941b 100644 --- a/Telegram/SourceFiles/core/version.h +++ b/Telegram/SourceFiles/core/version.h @@ -24,7 +24,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org #define BETA_VERSION_MACRO (0ULL) -constexpr int AppVersion = 1000026; -constexpr str_const AppVersionStr = "1.0.26"; +constexpr int AppVersion = 1000027; +constexpr str_const AppVersionStr = "1.0.27"; constexpr bool AppAlphaVersion = false; constexpr uint64 AppBetaVersion = BETA_VERSION_MACRO; diff --git a/Telegram/SourceFiles/platform/linux/linux_libs.cpp b/Telegram/SourceFiles/platform/linux/linux_libs.cpp index d7a44f4057..b6d18ae904 100644 --- a/Telegram/SourceFiles/platform/linux/linux_libs.cpp +++ b/Telegram/SourceFiles/platform/linux/linux_libs.cpp @@ -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; diff --git a/Telegram/SourceFiles/platform/linux/linux_libs.h b/Telegram/SourceFiles/platform/linux/linux_libs.h index 2242121870..a8bf969cd8 100644 --- a/Telegram/SourceFiles/platform/linux/linux_libs.h +++ b/Telegram/SourceFiles/platform/linux/linux_libs.h @@ -44,12 +44,12 @@ bool load(QLibrary &lib, const char *name, Function &func) { return false; } - func = reinterpret_cast(lib.resolve(name)); - if (func) { - return true; - } + func = reinterpret_cast(lib.resolve(name)); + if (func) { + return true; + } LOG(("Error: failed to load '%1' function!").arg(name)); - return false; + return false; } typedef gboolean (*f_gtk_init_check)(int *argc, char ***argv); @@ -181,6 +181,9 @@ extern f_gtk_image_new gtk_image_new; typedef void (*f_gtk_image_set_from_pixbuf)(GtkImage *image, GdkPixbuf *pixbuf); extern f_gtk_image_set_from_pixbuf gtk_image_set_from_pixbuf; +typedef void (*f_gdk_set_allowed_backends)(const gchar *backends); +extern f_gdk_set_allowed_backends gdk_set_allowed_backends; + typedef void (*f_gdk_window_set_modal_hint)(GdkWindow *window, gboolean modal); extern f_gdk_window_set_modal_hint gdk_window_set_modal_hint; diff --git a/Telegram/build/version b/Telegram/build/version index 46180e1f4a..2ac270b7df 100644 --- a/Telegram/build/version +++ b/Telegram/build/version @@ -1,6 +1,6 @@ -AppVersion 1000026 +AppVersion 1000027 AppVersionStrMajor 1.0 -AppVersionStrSmall 1.0.26 -AppVersionStr 1.0.26 +AppVersionStrSmall 1.0.27 +AppVersionStr 1.0.27 AlphaChannel 0 BetaVersion 0 diff --git a/changelog.txt b/changelog.txt index 2052779870..4a29e17064 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,8 @@ +1.0.27 (31.03.17) + +- Fix launch in Ubuntu 17.04. +- Update API scheme. + 1.0.26 (30.03.17) — Send MP4/MOV files as videos that will play right inside Telegram.