summaryrefslogtreecommitdiff
path: root/sal
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2022-02-03 07:42:57 +0100
committerMike Kaganski <mike.kaganski@collabora.com>2022-02-03 10:52:47 +0100
commitfdf84b42a09fa2eed03dccfaeec98dba720e6557 (patch)
treed31328ceb24abd90a30b19165d4e6a7e877f57a9 /sal
parent5d3c8da8c320a950d94e0809c165dac8482f8837 (diff)
Call SymInitialize only once
Also simplify the logic by passing fInvadeProcess = false there, since passing true is the same as calling SymRefreshModuleList explicitly. Fixes an overlook from commit 853a058ca6b75b0fb14e232911eb9f9553574736. Change-Id: I296f06845a9f92375908d72e69574c2ecd190028 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129338 Tested-by: Mike Kaganski <mike.kaganski@collabora.com> Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
Diffstat (limited to 'sal')
-rw-r--r--sal/osl/w32/backtrace.cxx10
1 files changed, 3 insertions, 7 deletions
diff --git a/sal/osl/w32/backtrace.cxx b/sal/osl/w32/backtrace.cxx
index fab3c5043a60..d9231de44517 100644
--- a/sal/osl/w32/backtrace.cxx
+++ b/sal/osl/w32/backtrace.cxx
@@ -61,13 +61,9 @@ OUString sal::backtrace_to_string(BacktraceState* backtraceState)
{
HANDLE hProcess = GetCurrentProcess();
// https://docs.microsoft.com/en-us/windows/win32/api/dbghelp/nf-dbghelp-syminitialize
- // says to not initialize more than once. This still leaks for some
- // reason if called often enough.
- static bool needsInit = true;
- if( needsInit )
- SymInitialize( hProcess, nullptr, true );
- else
- SymRefreshModuleList( hProcess );
+ // says to not initialize more than once.
+ [[maybe_unused]] static bool bInitialized = SymInitialize(hProcess, nullptr, false);
+ SymRefreshModuleList(hProcess);
SYMBOL_INFO * pSymbol;
pSymbol = static_cast<SYMBOL_INFO *>(calloc( sizeof( SYMBOL_INFO ) + 1024 * sizeof( char ), 1 ));
assert(pSymbol);