summaryrefslogtreecommitdiff
path: root/editeng
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2023-06-14 13:32:01 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2023-06-15 18:15:18 +0200
commit1a253362f6d1e1909913dce298630c92d431e41e (patch)
treef97468cd564328fffab6870a82a7326bddf70809 /editeng
parentc7dfec21b44b23c4e52b938721f356f75046f37b (diff)
speed up startup time
by avoid conversion of static locale data from sal_Unicode to OUString data - we can declare the data as OUStringConstExpr arrays and then no conversion is necessary. Here we trigger a problem - EditDLL has static data that tends to get torn down __after__ the i18npool shared library has been removed from memory, which means it tries to access OUStringLiteral objects that no longer exists. So use vcl::DeleteOnExit to explicitly clear that on application shutdown. Change-Id: Ie4bfcef7eb4656316ea825474ac42f85844d1dcc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153060 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'editeng')
-rw-r--r--editeng/source/editeng/eerdll.cxx10
1 files changed, 8 insertions, 2 deletions
diff --git a/editeng/source/editeng/eerdll.cxx b/editeng/source/editeng/eerdll.cxx
index b7120bd1befd..f6a1cbc049c2 100644
--- a/editeng/source/editeng/eerdll.cxx
+++ b/editeng/source/editeng/eerdll.cxx
@@ -64,13 +64,19 @@
#include <editeng/forbiddencharacterstable.hxx>
#include <editeng/justifyitem.hxx>
#include <tools/mapunit.hxx>
+#include <vcl/lazydelete.hxx>
using namespace ::com::sun::star;
EditDLL& EditDLL::Get()
{
- static EditDLL theEditDLL;
- return theEditDLL;
+ /**
+ Prevent use-after-free errors during application shutdown.
+ Previously this data was function-static, but then data in i18npool would
+ be torn down before the destructor here ran, causing a crash.
+ */
+ static vcl::DeleteOnDeinit< EditDLL > gaEditDll;
+ return *gaEditDll.get();
}
DefItems::DefItems()