diff options
author | bruvzg <7645683+bruvzg@users.noreply.github.com> | 2023-02-21 09:43:54 +0200 |
---|---|---|
committer | Yuri Sizov <yuris@humnom.net> | 2023-03-13 14:04:41 +0100 |
commit | 466d226a4acc66fc1c1c4faf8d9da68e6c84fbda (patch) | |
tree | 057ef30f95f76723d5191c1313075af6adc1f5c7 /modules | |
parent | e290448fe3295b43f06f23eacb7a07cdc3d064a8 (diff) |
[TextServer] Ensure ICU data is initialised only one and cleaned only at exit.
(cherry picked from commit 7f24433e15081044aa8bcc3a646ded5129048bf5)
Diffstat (limited to 'modules')
-rw-r--r-- | modules/text_server_adv/text_server_adv.cpp | 5 | ||||
-rw-r--r-- | modules/text_server_adv/text_server_adv.h | 2 |
2 files changed, 5 insertions, 2 deletions
diff --git a/modules/text_server_adv/text_server_adv.cpp b/modules/text_server_adv/text_server_adv.cpp index 22652daa24..007f439a89 100644 --- a/modules/text_server_adv/text_server_adv.cpp +++ b/modules/text_server_adv/text_server_adv.cpp @@ -334,6 +334,8 @@ _FORCE_INLINE_ bool is_connected_to_prev(char32_t p_chr, char32_t p_pchr) { /*************************************************************************/ +bool TextServerAdvanced::icu_data_loaded = false; + bool TextServerAdvanced::_has_feature(Feature p_feature) const { switch (p_feature) { case FEATURE_SIMPLE_LAYOUT: @@ -6599,5 +6601,6 @@ TextServerAdvanced::~TextServerAdvanced() { uset_close(allowed); allowed = nullptr; } - u_cleanup(); + + std::atexit(u_cleanup); } diff --git a/modules/text_server_adv/text_server_adv.h b/modules/text_server_adv/text_server_adv.h index 02244a294e..f092fa8cca 100644 --- a/modules/text_server_adv/text_server_adv.h +++ b/modules/text_server_adv/text_server_adv.h @@ -158,7 +158,7 @@ class TextServerAdvanced : public TextServerExtension { // ICU support data. - bool icu_data_loaded = false; + static bool icu_data_loaded; mutable USet *allowed = nullptr; mutable USpoofChecker *sc_spoof = nullptr; mutable USpoofChecker *sc_conf = nullptr; |