diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-05-17 13:07:22 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-05-17 19:43:49 +0200 |
commit | 901b05e9fc852333824b6e58d0a30834b1211acd (patch) | |
tree | c2c58182e9bc3eb908be20c7e02eba4e25b98d0f /i18npool | |
parent | 08ffd34d5274e745a1400c70f94fc297f5ad8569 (diff) |
don't leak ICU transliterator
Change-Id: Ib2c09c6c63b94d078ddde15585caa59710953bba
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115702
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'i18npool')
-rw-r--r-- | i18npool/inc/transliteration_Ignore.hxx | 3 | ||||
-rw-r--r-- | i18npool/source/transliteration/ignoreDiacritics_CTL.cxx | 4 |
2 files changed, 4 insertions, 3 deletions
diff --git a/i18npool/inc/transliteration_Ignore.hxx b/i18npool/inc/transliteration_Ignore.hxx index 838c48d53803..854dbfeb5cac 100644 --- a/i18npool/inc/transliteration_Ignore.hxx +++ b/i18npool/inc/transliteration_Ignore.hxx @@ -21,6 +21,7 @@ #include "transliteration_commonclass.hxx" #include <unicode/translit.h> +#include <memory> namespace i18nutil { class oneToOneMapping; } @@ -91,7 +92,7 @@ TRANSLITERATION_IGNORE(Kashida_CTL) class ignoreDiacritics_CTL final : public transliteration_Ignore { - icu::Transliterator* m_transliterator; + std::unique_ptr<icu::Transliterator> m_transliterator; public: ignoreDiacritics_CTL(); diff --git a/i18npool/source/transliteration/ignoreDiacritics_CTL.cxx b/i18npool/source/transliteration/ignoreDiacritics_CTL.cxx index ada76a735b80..5980f8e8d2f7 100644 --- a/i18npool/source/transliteration/ignoreDiacritics_CTL.cxx +++ b/i18npool/source/transliteration/ignoreDiacritics_CTL.cxx @@ -23,8 +23,8 @@ ignoreDiacritics_CTL::ignoreDiacritics_CTL() implementationName = "com.sun.star.i18n.Transliteration.ignoreDiacritics_CTL"; UErrorCode nStatus = U_ZERO_ERROR; - m_transliterator = icu::Transliterator::createInstance("NFD; [:M:] Remove; NFC", - UTRANS_FORWARD, nStatus); + m_transliterator.reset( icu::Transliterator::createInstance("NFD; [:M:] Remove; NFC", + UTRANS_FORWARD, nStatus) ); if (U_FAILURE(nStatus)) m_transliterator = nullptr; } |