[Libreoffice-commits] core.git: sc/source
Luboš Luňák
l.lunak at collabora.com
Sat Jun 2 18:36:55 UTC 2018
sc/source/core/data/global.cxx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
New commits:
commit 656e5cecbef254c08c871381abc8364a761a6b94
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>
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)
More information about the Libreoffice-commits
mailing list