From a93c3f2eb07fc15d1ebb0fd70ab58ecea27bd4f1 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Fri, 24 Sep 2021 16:54:48 +0200 Subject: GError::message is UTF-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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(*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=) at shell/source/sessioninstall/SyncDbusSessionHelper.cxx:35 > #7 0x00007fd1525ad6a5 in (anonymous namespace)::request(char const*, com::sun::star::uno::Sequence 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 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::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 --- shell/source/sessioninstall/SyncDbusSessionHelper.cxx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'shell') 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 #include +#include #include #include #include @@ -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); } -- cgit