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:
@@ -179,7 +179,7 @@ std::shared_ptr<DefItems> GlobalEditData::GetDefItems()
|
|||||||
std::shared_ptr<SvxForbiddenCharactersTable> const & GlobalEditData::GetForbiddenCharsTable()
|
std::shared_ptr<SvxForbiddenCharactersTable> const & GlobalEditData::GetForbiddenCharsTable()
|
||||||
{
|
{
|
||||||
if (!xForbiddenCharsTable)
|
if (!xForbiddenCharsTable)
|
||||||
xForbiddenCharsTable.reset(new SvxForbiddenCharactersTable(::comphelper::getProcessComponentContext()));
|
xForbiddenCharsTable = SvxForbiddenCharactersTable::makeForbiddenCharactersTable(::comphelper::getProcessComponentContext());
|
||||||
return xForbiddenCharsTable;
|
return xForbiddenCharsTable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -25,9 +25,14 @@
|
|||||||
|
|
||||||
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
|
#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 )
|
const css::i18n::ForbiddenCharacters* SvxForbiddenCharactersTable::GetForbiddenCharacters( LanguageType nLanguage, bool bGetDefault )
|
||||||
|
@@ -26,6 +26,7 @@
|
|||||||
#include <editeng/editengdllapi.h>
|
#include <editeng/editengdllapi.h>
|
||||||
#include <i18nlangtag/lang.h>
|
#include <i18nlangtag/lang.h>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
namespace com {
|
namespace com {
|
||||||
namespace sun {
|
namespace sun {
|
||||||
@@ -41,9 +42,10 @@ public:
|
|||||||
private:
|
private:
|
||||||
Map maMap;
|
Map maMap;
|
||||||
css::uno::Reference< css::uno::XComponentContext > m_xContext;
|
css::uno::Reference< css::uno::XComponentContext > m_xContext;
|
||||||
|
SvxForbiddenCharactersTable(const css::uno::Reference< css::uno::XComponentContext >& rxContext);
|
||||||
|
|
||||||
public:
|
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; }
|
Map& GetMap() { return maMap; }
|
||||||
const css::i18n::ForbiddenCharacters* GetForbiddenCharacters( LanguageType nLanguage, bool bGetDefault );
|
const css::i18n::ForbiddenCharacters* GetForbiddenCharacters( LanguageType nLanguage, bool bGetDefault );
|
||||||
|
@@ -128,7 +128,7 @@ void ScDocShell::InitItems()
|
|||||||
if (aLocales.getLength())
|
if (aLocales.getLength())
|
||||||
{
|
{
|
||||||
std::shared_ptr<SvxForbiddenCharactersTable> xForbiddenTable(
|
std::shared_ptr<SvxForbiddenCharactersTable> xForbiddenTable(
|
||||||
new SvxForbiddenCharactersTable(comphelper::getProcessComponentContext()));
|
SvxForbiddenCharactersTable::makeForbiddenCharactersTable(comphelper::getProcessComponentContext()));
|
||||||
|
|
||||||
const lang::Locale* pLocales = aLocales.getConstArray();
|
const lang::Locale* pLocales = aLocales.getConstArray();
|
||||||
for (sal_Int32 i = 0; i < aLocales.getLength(); i++)
|
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,
|
// create an empty SvxForbiddenCharactersTable for SvxUnoForbiddenCharsTable,
|
||||||
// so changes can be stored.
|
// so changes can be stored.
|
||||||
xRet.reset(new SvxForbiddenCharactersTable(comphelper::getProcessComponentContext()));
|
xRet = SvxForbiddenCharactersTable::makeForbiddenCharactersTable(comphelper::getProcessComponentContext());
|
||||||
rDoc.SetForbiddenCharacters( xRet );
|
rDoc.SetForbiddenCharacters( xRet );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -260,7 +260,7 @@ SdDrawDocument::SdDrawDocument(DocumentType eType, SfxObjectShell* pDrDocSh)
|
|||||||
if( xHyphenator.is() )
|
if( xHyphenator.is() )
|
||||||
rOutliner.SetHyphenator( xHyphenator );
|
rOutliner.SetHyphenator( xHyphenator );
|
||||||
|
|
||||||
SetForbiddenCharsTable(std::make_shared<SvxForbiddenCharactersTable>(::comphelper::getProcessComponentContext()));
|
SetForbiddenCharsTable(SvxForbiddenCharactersTable::makeForbiddenCharactersTable(::comphelper::getProcessComponentContext()));
|
||||||
}
|
}
|
||||||
catch(...)
|
catch(...)
|
||||||
{
|
{
|
||||||
|
@@ -432,7 +432,7 @@ void sw::DocumentSettingManager::setForbiddenCharacters(/*[in]*/ LanguageType nL
|
|||||||
/*[in]*/ const css::i18n::ForbiddenCharacters& rFChars )
|
/*[in]*/ const css::i18n::ForbiddenCharacters& rFChars )
|
||||||
{
|
{
|
||||||
if (!mxForbiddenCharsTable)
|
if (!mxForbiddenCharsTable)
|
||||||
mxForbiddenCharsTable.reset(new SvxForbiddenCharactersTable(::comphelper::getProcessComponentContext()));
|
mxForbiddenCharsTable = SvxForbiddenCharactersTable::makeForbiddenCharactersTable(::comphelper::getProcessComponentContext());
|
||||||
mxForbiddenCharsTable->SetForbiddenCharacters( nLang, rFChars );
|
mxForbiddenCharsTable->SetForbiddenCharacters( nLang, rFChars );
|
||||||
|
|
||||||
SdrModel *pDrawModel = m_rDoc.getIDocumentDrawModelAccess().GetDrawModel();
|
SdrModel *pDrawModel = m_rDoc.getIDocumentDrawModelAccess().GetDrawModel();
|
||||||
@@ -457,7 +457,7 @@ void sw::DocumentSettingManager::setForbiddenCharacters(/*[in]*/ LanguageType nL
|
|||||||
std::shared_ptr<SvxForbiddenCharactersTable>& sw::DocumentSettingManager::getForbiddenCharacterTable()
|
std::shared_ptr<SvxForbiddenCharactersTable>& sw::DocumentSettingManager::getForbiddenCharacterTable()
|
||||||
{
|
{
|
||||||
if (!mxForbiddenCharsTable)
|
if (!mxForbiddenCharsTable)
|
||||||
mxForbiddenCharsTable.reset(new SvxForbiddenCharactersTable(::comphelper::getProcessComponentContext()));
|
mxForbiddenCharsTable = SvxForbiddenCharactersTable::makeForbiddenCharactersTable(::comphelper::getProcessComponentContext());
|
||||||
return mxForbiddenCharsTable;
|
return mxForbiddenCharsTable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user