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>
This commit is contained in:
parent
ad0e7d5734
commit
6549993b17
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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 )
|
||||
|
@ -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 );
|
||||
|
@ -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++)
|
||||
|
@ -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 );
|
||||
}
|
||||
}
|
||||
|
@ -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(...)
|
||||
{
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user