AyuGramDesktop/Telegram/SourceFiles
Gleb Smirnoff 720f238cf8 Close a race between Gio threads and Qt application init.
QApplication has a historical feature[1] of calling setlocale(3) at init,
which today cause more harm than good.  Such call isn't thread safe neither
per C standard, not per any known libc implementation.  The Gio threads
would call into locale reading functions all the time, so early access to
locale by Gio may race with setlocale() by Qt leading to undefined behavior.

Platform specific start before the Sandbox (aka QApplication) is at core
design of tdesktop and that order can't be changed. There is no way to pause
Gio until QApplication instantiates.

Fortunately, Qt library itself has a static global flag that prevents it
from calling setlocale() twice. We don't even need to instantiate a
temporary QCoreApplication, we can just call into the method.  So call
it form Platform::start before any existing or future calls to Gio.

Fixes #16922

[1] https://chat.stackoverflow.com/rooms/63812/discussion-between-phil-armstrong-and-matteo-italia
2021-09-10 13:18:20 +03:00
..
_other Remove -externalupdater flag 2021-08-11 18:20:52 +03:00
api Appended references to const auto types in loop to prevent copying. 2021-09-09 16:32:04 +03:00
boxes Appended references to const auto types in loop to prevent copying. 2021-09-09 16:32:04 +03:00
calls Appended references to const auto types in loop to prevent copying. 2021-09-09 16:32:04 +03:00
chat_helpers Appended references to const auto types in loop to prevent copying. 2021-09-09 16:32:04 +03:00
codegen/scheme Update API scheme to layer 119. Count replies. 2020-09-29 19:03:18 +03:00
core Appended references to const auto types in loop to prevent copying. 2021-09-09 16:32:04 +03:00
countries Removed extra space from end of country patterns. 2021-09-09 16:32:07 +03:00
data Correctly apply photos from "min" users. 2021-09-09 16:59:36 +03:00
dialogs Appended references to const auto types in loop to prevent copying. 2021-09-09 16:32:04 +03:00
editor Use Images::Read instead of App::readImage. 2021-08-11 18:55:08 +03:00
export Appended references to const auto types in loop to prevent copying. 2021-09-09 16:32:04 +03:00
ffmpeg Use av_packet_alloc instead of av_init_packet. 2021-05-26 22:53:54 +04:00
history Update API scheme. 2021-09-10 12:58:52 +03:00
info Appended references to const auto types in loop to prevent copying. 2021-09-09 16:32:04 +03:00
inline_bots Update API scheme to layer 133. 2021-09-07 23:41:07 +03:00
intro Update API scheme to layer 133. 2021-09-07 23:41:07 +03:00
lang Appended references to const auto types in loop to prevent copying. 2021-09-09 16:32:04 +03:00
layout Add support for SVG patterns in wallpapers. 2021-08-11 19:56:12 +03:00
main Remove check used only for 32 bit ids. 2021-09-10 10:23:00 +03:00
media Appended references to const auto types in loop to prevent copying. 2021-09-09 16:32:04 +03:00
mtproto Update User-Agent for DNS to Chrome 92.0.4515.131. 2021-09-07 12:24:42 +03:00
overview Custom colors in history_view_document module. 2021-09-06 13:13:26 +03:00
passport Appended references to const auto types in loop to prevent copying. 2021-09-09 16:32:04 +03:00
payments Appended references to const auto types in loop to prevent copying. 2021-09-09 16:32:04 +03:00
platform Close a race between Gio threads and Qt application init. 2021-09-10 13:18:20 +03:00
profile Appended references to const auto types in loop to prevent copying. 2021-09-09 16:32:04 +03:00
settings Update API scheme to layer 133. 2021-09-07 23:41:07 +03:00
storage Support 64 bit peer-bare-ids in export settings. 2021-09-07 23:41:07 +03:00
support Appended references to const auto types in loop to prevent copying. 2021-09-09 16:32:04 +03:00
ui Removed extra space from end of country patterns. 2021-09-09 16:32:07 +03:00
window Appended references to const auto types in loop to prevent copying. 2021-09-09 16:32:04 +03:00
apiwrap.cpp Appended references to const auto types in loop to prevent copying. 2021-09-09 16:32:04 +03:00
apiwrap.h Update API scheme to layer 133. 2021-09-07 23:41:07 +03:00
app.cpp Use Images::Read instead of App::readImage. 2021-08-11 18:55:08 +03:00
app.h Use Images::Read instead of App::readImage. 2021-08-11 18:55:08 +03:00
config.h Add local validation for card information. 2021-04-06 18:41:15 +04:00
facades.cpp Removed ui_getPeerForMouseAction. 2021-07-27 02:50:08 +03:00
facades.h Removed Main::Session forward declaration from data_types. 2021-09-01 01:23:20 +03:00
logs.cpp Fix some warnings from GCC 11 2021-06-01 19:33:19 +03:00
logs.h Fix possible deadlock in debug logs. 2021-05-13 15:36:08 +04:00
main.cpp Use single LEGAL file with license and copyright. 2018-01-03 13:23:14 +03:00
mainwidget.cpp Appended references to const auto types in loop to prevent copying. 2021-09-09 16:32:04 +03:00
mainwidget.h Add simple forwarding options on bar click. 2021-08-31 19:47:38 +03:00
mainwindow.cpp Replaced instant base::call_delayed with InvokeQueued. 2021-09-07 23:41:07 +03:00
mainwindow.h Removed using of hardcoded numbers of tray menu actions. 2021-07-06 12:13:06 +03:00
settings.cpp Move recent emoji and variants to common settings. 2021-04-26 10:51:10 +04:00
settings.h Move recent emoji and variants to common settings. 2021-04-26 10:51:10 +04:00
stdafx.h Get rid of osx and linux32 special targets 2021-08-11 16:59:27 +03:00