diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2021-09-24 16:54:48 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2021-09-24 20:53:42 +0200 |
commit | a93c3f2eb07fc15d1ebb0fd70ab58ecea27bd4f1 (patch) | |
tree | c7f025ea56e72043d9ba0b67e6278c05a1270b45 /shell | |
parent | e3227975c0f42ff23d528f5ab94b4538c8af764c (diff) |
GError::message is UTF-8
This caused CppunitTest_sw_dialogs_test to fail for LO_TEST_LOCALE=or hitting
> sal/rtl/ustring.cxx:530: void rtl_uString_newFromAscii(rtl_uString**, const char*): Assertion `static_cast<unsigned char>(*pCharStr) < 0x80' failed.
at
> #4 0x00007fd18a844f74 in rtl_uString_newFromAscii(rtl_uString**, char const*) (ppThis=0x7ffcb73e6e90, pCharStr=0x6191180 "ସମୟ ସୀମା ପହଞ୍ଚିଯାଇଛି") at sal/rtl/ustring.cxx:530
> #5 0x00007fd1525af9c1 in rtl::OUString::createFromAscii(char const*) (value=0x6191180 "ସମୟ ସୀମା ପହଞ୍ଚିଯାଇଛି") at include/rtl/ustring.hxx:3328
> #6 0x00007fd1525ad026 in (anonymous namespace)::GErrorWrapper::~GErrorWrapper() (this=0x7ffcb73e6f38, __in_chrg=<optimized out>) at shell/source/sessioninstall/SyncDbusSessionHelper.cxx:35
> #7 0x00007fd1525ad6a5 in (anonymous namespace)::request(char const*, com::sun::star::uno::Sequence<rtl::OUString> const&, std::u16string_view) (method=0x7fd1525b481d "InstallFontconfigResources", resources=uno::Sequence of length 1 = {...}, interaction=u"hide-finished") at shell/source/sessioninstall/SyncDbusSessionHelper.cxx:91
> #8 0x00007fd1525ada9d in shell::sessioninstall::SyncDbusSessionHelper::InstallFontconfigResources(com::sun::star::uno::Sequence<rtl::OUString> const&, rtl::OUString const&) (this=0x5d22380, resources=uno::Sequence of length 1 = {...}, interaction="hide-finished") at shell/source/sessioninstall/SyncDbusSessionHelper.cxx:158
> #9 0x00007fd178670daa in psp::PrintFontManager::autoInstallFontLangSupport(Timer*) (this=0x2e3ed90) at vcl/unx/generic/fontmanager/fontconfig.cxx:962
> #10 0x00007fd178670cd9 in psp::PrintFontManager::LinkStubautoInstallFontLangSupport(void*, Timer*) (instance=0x2e3ed90, data=0x2e3efa0) at vcl/unx/generic/fontmanager/fontconfig.cxx:956
> #11 0x00007fd178341e03 in Link<Timer*, void>::Call(Timer*) const (this=0x2e3efc0, data=0x2e3efa0) at include/tools/link.hxx:111
[...]
(But probably better to use the lenient OUString-from-rtl_TextEncoding ctor
rather than OUString::fromUtf8, in case GError::message happens to not contain
proper UTF-8 after all, which would make the latter assert.)
Change-Id: I61fede4576988c5f7f35bb071ab3f2c0e7a15aa1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122599
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'shell')
-rw-r--r-- | shell/source/sessioninstall/SyncDbusSessionHelper.cxx | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/shell/source/sessioninstall/SyncDbusSessionHelper.cxx b/shell/source/sessioninstall/SyncDbusSessionHelper.cxx index df2ef3529145..606eeb8fef03 100644 --- a/shell/source/sessioninstall/SyncDbusSessionHelper.cxx +++ b/shell/source/sessioninstall/SyncDbusSessionHelper.cxx @@ -11,6 +11,7 @@ #include <cppuhelper/supportsservice.hxx> #include <gio/gio.h> +#include <cstring> #include <memory> #include <string_view> #include <vector> @@ -32,7 +33,8 @@ namespace { if(!m_pError) return; - OUString sMsg = OUString::createFromAscii(m_pError->message); + OUString sMsg( + m_pError->message, std::strlen(m_pError->message), RTL_TEXTENCODING_UTF8); g_error_free(m_pError); throw RuntimeException(sMsg); } |