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

@ -9,7 +9,7 @@
<Identity Name="TelegramMessengerLLP.TelegramDesktop"
ProcessorArchitecture="x64"
Publisher="CN=536BC709-8EE1-4478-AF22-F0F0F26FF64A"
Version="1.0.26.0" />
Version="1.0.27.0" />
<Properties>
<DisplayName>Telegram Desktop</DisplayName>
<PublisherDisplayName>Telegram Messenger LLP</PublisherDisplayName>

View File

@ -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"

View File

@ -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"

View File

@ -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;

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;

View File

@ -44,12 +44,12 @@ bool load(QLibrary &lib, const char *name, Function &func) {
return false;
}
func = reinterpret_cast<Function>(lib.resolve(name));
if (func) {
return true;
}
func = reinterpret_cast<Function>(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;

View File

@ -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

View File

@ -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.