[Libreoffice-commits] core.git: Branch 'libreoffice-6-1' - 2 commits - sc/source
Luboš Luňák
l.lunak at collabora.com
Mon Jun 4 14:13:36 UTC 2018
sc/source/core/data/global.cxx | 27 ++++++++++++---------------
1 file changed, 12 insertions(+), 15 deletions(-)
New commits:
commit 64040ca17910ac2904e33305d41736dd9942eb9c
Author: Luboš Luňák <l.lunak at collabora.com>
Date: Sat Jun 2 17:58:40 2018 +0200
fix memory leak in double-checked init
The pointer indeed shouldn't be just a local argument but a reference
to the global variable, otherwise just the argument gets set.
Change-Id: Ib7060943b089336b409d4861540a861ca2793cde
Reviewed-on: https://gerrit.libreoffice.org/55209
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Luboš Luňák <l.lunak at collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/55280
Tested-by: Luboš Luňák <l.lunak at collabora.com>
diff --git a/sc/source/core/data/global.cxx b/sc/source/core/data/global.cxx
index 6e258407653d..bf76a7085758 100644
--- a/sc/source/core/data/global.cxx
+++ b/sc/source/core/data/global.cxx
@@ -133,7 +133,7 @@ bool ScGlobal::bThreadedGroupCalcInProgress = false;
template< typename Type, typename Function = std::function< Type*() >,
typename Guard = osl::MutexGuard, typename GuardCtor = osl::GetGlobalMutex >
static inline
-Type* doubleCheckedInit( Type* pointer, Function function, GuardCtor guardCtor = osl::GetGlobalMutex())
+Type* doubleCheckedInit( Type*& pointer, Function function, GuardCtor guardCtor = osl::GetGlobalMutex())
{
Type* p = pointer;
if (!p)
commit 5f4f95ce419b452b9b8a1760f76391dc2a60baf3
Author: Luboš Luňák <l.lunak at collabora.com>
Date: Wed May 30 09:26:42 2018 +0200
move related functions next to each other
And remove a pointless assert (the object is now created on demand).
Change-Id: Ib42164b57216499e53ebc4ed5d1bc270055db2e7
Reviewed-on: https://gerrit.libreoffice.org/55046
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Michael Meeks <michael.meeks at collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/55279
Reviewed-by: Luboš Luňák <l.lunak at collabora.com>
Tested-by: Luboš Luňák <l.lunak at collabora.com>
diff --git a/sc/source/core/data/global.cxx b/sc/source/core/data/global.cxx
index 0ac839200cb3..6e258407653d 100644
--- a/sc/source/core/data/global.cxx
+++ b/sc/source/core/data/global.cxx
@@ -1016,11 +1016,19 @@ utl::TransliterationWrapper* ScGlobal::GetpTransliteration()
::comphelper::getProcessComponentContext(), TransliterationFlags::IGNORE_CASE );
pTransliteration->loadModuleIfNeeded( eOfficeLanguage );
}
- OSL_ENSURE(
- pTransliteration,
- "ScGlobal::GetpTransliteration() called before ScGlobal::Init()");
return pTransliteration;
}
+::utl::TransliterationWrapper* ScGlobal::GetCaseTransliteration()
+{
+ assert(!bThreadedGroupCalcInProgress);
+ if ( !pCaseTransliteration )
+ {
+ const LanguageType eOfficeLanguage = Application::GetSettings().GetLanguageTag().getLanguageType();
+ pCaseTransliteration = new ::utl::TransliterationWrapper(::comphelper::getProcessComponentContext(), TransliterationFlags::NONE );
+ pCaseTransliteration->loadModuleIfNeeded( eOfficeLanguage );
+ }
+ return pCaseTransliteration;
+}
const LocaleDataWrapper* ScGlobal::GetpLocaleData()
{
@@ -1059,17 +1067,6 @@ CollatorWrapper* ScGlobal::GetCaseCollator()
return p;
});
}
-::utl::TransliterationWrapper* ScGlobal::GetCaseTransliteration()
-{
- assert(!bThreadedGroupCalcInProgress);
- if ( !pCaseTransliteration )
- {
- const LanguageType eOfficeLanguage = Application::GetSettings().GetLanguageTag().getLanguageType();
- pCaseTransliteration = new ::utl::TransliterationWrapper(::comphelper::getProcessComponentContext(), TransliterationFlags::NONE );
- pCaseTransliteration->loadModuleIfNeeded( eOfficeLanguage );
- }
- return pCaseTransliteration;
-}
css::lang::Locale* ScGlobal::GetLocale()
{
assert(!bThreadedGroupCalcInProgress);
More information about the Libreoffice-commits
mailing list