[Libreoffice-commits] core.git: editeng/source include/editeng sc/source sd/source sw/source
Caolán McNamara
caolanm at redhat.com
Thu Jul 6 07:30:15 UTC 2017
editeng/source/editeng/eerdll.cxx | 2 +-
editeng/source/misc/forbiddencharacterstable.cxx | 9 +++++++--
include/editeng/forbiddencharacterstable.hxx | 4 +++-
sc/source/ui/docshell/docsh2.cxx | 2 +-
sc/source/ui/unoobj/forbiuno.cxx | 2 +-
sd/source/core/drawdoc.cxx | 2 +-
sw/source/core/doc/DocumentSettingManager.cxx | 4 ++--
7 files changed, 16 insertions(+), 9 deletions(-)
New commits:
commit 6549993b17feb1423c76b5237f086e6f35346a2c
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Jul 5 15:40:00 2017 +0100
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 at libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
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 )
diff --git a/include/editeng/forbiddencharacterstable.hxx b/include/editeng/forbiddencharacterstable.hxx
index 6923f550070d..156bd85bfacd 100644
--- a/include/editeng/forbiddencharacterstable.hxx
+++ b/include/editeng/forbiddencharacterstable.hxx
@@ -26,6 +26,7 @@
#include <editeng/editengdllapi.h>
#include <i18nlangtag/lang.h>
#include <map>
+#include <memory>
namespace com {
namespace sun {
@@ -41,9 +42,10 @@ public:
private:
Map maMap;
css::uno::Reference< css::uno::XComponentContext > m_xContext;
+ SvxForbiddenCharactersTable(const css::uno::Reference< css::uno::XComponentContext >& rxContext);
public:
- SvxForbiddenCharactersTable( const css::uno::Reference< css::uno::XComponentContext >& rxContext);
+ static std::shared_ptr<SvxForbiddenCharactersTable> makeForbiddenCharactersTable(const css::uno::Reference<css::uno::XComponentContext>& rxContext);
Map& GetMap() { return maMap; }
const css::i18n::ForbiddenCharacters* GetForbiddenCharacters( LanguageType nLanguage, bool bGetDefault );
diff --git a/sc/source/ui/docshell/docsh2.cxx b/sc/source/ui/docshell/docsh2.cxx
index 4055666e2201..2ae71b4f101d 100644
--- a/sc/source/ui/docshell/docsh2.cxx
+++ b/sc/source/ui/docshell/docsh2.cxx
@@ -128,7 +128,7 @@ void ScDocShell::InitItems()
if (aLocales.getLength())
{
std::shared_ptr<SvxForbiddenCharactersTable> xForbiddenTable(
- new SvxForbiddenCharactersTable(comphelper::getProcessComponentContext()));
+ SvxForbiddenCharactersTable::makeForbiddenCharactersTable(comphelper::getProcessComponentContext()));
const lang::Locale* pLocales = aLocales.getConstArray();
for (sal_Int32 i = 0; i < aLocales.getLength(); i++)
diff --git a/sc/source/ui/unoobj/forbiuno.cxx b/sc/source/ui/unoobj/forbiuno.cxx
index 732487b0defc..d177ac1be7e3 100644
--- a/sc/source/ui/unoobj/forbiuno.cxx
+++ b/sc/source/ui/unoobj/forbiuno.cxx
@@ -35,7 +35,7 @@ static std::shared_ptr<SvxForbiddenCharactersTable> lcl_GetForbidden( ScDocShell
{
// create an empty SvxForbiddenCharactersTable for SvxUnoForbiddenCharsTable,
// so changes can be stored.
- xRet.reset(new SvxForbiddenCharactersTable(comphelper::getProcessComponentContext()));
+ xRet = SvxForbiddenCharactersTable::makeForbiddenCharactersTable(comphelper::getProcessComponentContext());
rDoc.SetForbiddenCharacters( xRet );
}
}
diff --git a/sd/source/core/drawdoc.cxx b/sd/source/core/drawdoc.cxx
index a22e60f0ff8d..0977fa5f1d9b 100644
--- a/sd/source/core/drawdoc.cxx
+++ b/sd/source/core/drawdoc.cxx
@@ -260,7 +260,7 @@ SdDrawDocument::SdDrawDocument(DocumentType eType, SfxObjectShell* pDrDocSh)
if( xHyphenator.is() )
rOutliner.SetHyphenator( xHyphenator );
- SetForbiddenCharsTable(std::make_shared<SvxForbiddenCharactersTable>(::comphelper::getProcessComponentContext()));
+ SetForbiddenCharsTable(SvxForbiddenCharactersTable::makeForbiddenCharactersTable(::comphelper::getProcessComponentContext()));
}
catch(...)
{
diff --git a/sw/source/core/doc/DocumentSettingManager.cxx b/sw/source/core/doc/DocumentSettingManager.cxx
index f8f38b4dde73..ee28751a6cdb 100644
--- a/sw/source/core/doc/DocumentSettingManager.cxx
+++ b/sw/source/core/doc/DocumentSettingManager.cxx
@@ -432,7 +432,7 @@ void sw::DocumentSettingManager::setForbiddenCharacters(/*[in]*/ LanguageType nL
/*[in]*/ const css::i18n::ForbiddenCharacters& rFChars )
{
if (!mxForbiddenCharsTable)
- mxForbiddenCharsTable.reset(new SvxForbiddenCharactersTable(::comphelper::getProcessComponentContext()));
+ mxForbiddenCharsTable = SvxForbiddenCharactersTable::makeForbiddenCharactersTable(::comphelper::getProcessComponentContext());
mxForbiddenCharsTable->SetForbiddenCharacters( nLang, rFChars );
SdrModel *pDrawModel = m_rDoc.getIDocumentDrawModelAccess().GetDrawModel();
@@ -457,7 +457,7 @@ void sw::DocumentSettingManager::setForbiddenCharacters(/*[in]*/ LanguageType nL
std::shared_ptr<SvxForbiddenCharactersTable>& sw::DocumentSettingManager::getForbiddenCharacterTable()
{
if (!mxForbiddenCharsTable)
- mxForbiddenCharsTable.reset(new SvxForbiddenCharactersTable(::comphelper::getProcessComponentContext()));
+ mxForbiddenCharsTable = SvxForbiddenCharactersTable::makeForbiddenCharactersTable(::comphelper::getProcessComponentContext());
return mxForbiddenCharsTable;
}
More information about the Libreoffice-commits
mailing list