diff options
author | Caolán McNamara <caolanm@redhat.com> | 2017-07-05 15:40:00 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2017-07-06 09:29:45 +0200 |
commit | 6549993b17feb1423c76b5237f086e6f35346a2c (patch) | |
tree | 8137a443acf338d2636ded0e2a12fd82f523cb87 /editeng | |
parent | ad0e7d5734b3b759b1ef4aa794e2a31d79a2ecd1 (diff) |
ensure safe GlobalEditData release of xForbiddenCharsTable
ensure that when the editeng GlobalEditData dtor is called
that the vtable of the xForbiddenCharsTable shared_ptr will
point to functions that are callable from editeng.
otherwise a shared_ptr created in the sw uwriter cppunit test,
but now belonging to GlobalEditData, will have deleter entries
pointing to functions in uwriter that have been unloaded and
are not available anymore
Change-Id: I375a84156c0b1a0f8b24194fc07f0c512f556dbc
Reviewed-on: https://gerrit.libreoffice.org/39605
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'editeng')
-rw-r--r-- | editeng/source/editeng/eerdll.cxx | 2 | ||||
-rw-r--r-- | editeng/source/misc/forbiddencharacterstable.cxx | 9 |
2 files changed, 8 insertions, 3 deletions
diff --git a/editeng/source/editeng/eerdll.cxx b/editeng/source/editeng/eerdll.cxx index 04ae2c953bf5..2027cab81a50 100644 --- a/editeng/source/editeng/eerdll.cxx +++ b/editeng/source/editeng/eerdll.cxx @@ -179,7 +179,7 @@ std::shared_ptr<DefItems> GlobalEditData::GetDefItems() std::shared_ptr<SvxForbiddenCharactersTable> const & GlobalEditData::GetForbiddenCharsTable() { if (!xForbiddenCharsTable) - xForbiddenCharsTable.reset(new SvxForbiddenCharactersTable(::comphelper::getProcessComponentContext())); + xForbiddenCharsTable = SvxForbiddenCharactersTable::makeForbiddenCharactersTable(::comphelper::getProcessComponentContext()); return xForbiddenCharsTable; } diff --git a/editeng/source/misc/forbiddencharacterstable.cxx b/editeng/source/misc/forbiddencharacterstable.cxx index f52c90eb2b86..563461b75c24 100644 --- a/editeng/source/misc/forbiddencharacterstable.cxx +++ b/editeng/source/misc/forbiddencharacterstable.cxx @@ -25,9 +25,14 @@ #include <com/sun/star/lang/XMultiServiceFactory.hpp> -SvxForbiddenCharactersTable::SvxForbiddenCharactersTable( const css::uno::Reference< css::uno::XComponentContext >& rxContext) +SvxForbiddenCharactersTable::SvxForbiddenCharactersTable(const css::uno::Reference< css::uno::XComponentContext >& rxContext) + : m_xContext(rxContext) { - m_xContext = rxContext; +} + +std::shared_ptr<SvxForbiddenCharactersTable> SvxForbiddenCharactersTable::makeForbiddenCharactersTable(const css::uno::Reference< css::uno::XComponentContext>& rxContext) +{ + return std::shared_ptr<SvxForbiddenCharactersTable>(new SvxForbiddenCharactersTable(rxContext)); } const css::i18n::ForbiddenCharacters* SvxForbiddenCharactersTable::GetForbiddenCharacters( LanguageType nLanguage, bool bGetDefault ) |