cid#562881 Double unlock
the double-unlock finding is a bit bogus, but there is a real oddity here worth fixing. since: commit6c9909dee4Date: Fri Oct 22 14:11:39 2021 +0200 fix std::unique_lock unlocking84a54f6c38moved the end() test inside the guard, but left the dereference outside it Signed-off-by: Caolán McNamara <caolan.mcnamara@collabora.com> Change-Id: Ia439ebffc9179e74d926efc7c3ea7dec2fc1f7db Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/9964 Reviewed-by: Noel Grandin <noel.grandin@collabora.com> Tested-by: Jenkins CPCI <releng@collaboraoffice.com> (cherry picked from commit 791c9f631b0ce352d356f5486ba537c9a4d3f8fc) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/210134 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
This commit is contained in:
committed by
Xisco Fauli
parent
824c8c356e
commit
5e3fe53bdb
@@ -203,16 +203,20 @@ OUString sal::backtrace_to_string(BacktraceState* backtraceState)
|
||||
{
|
||||
Dl_info dli;
|
||||
void* addr = backtraceState->buffer[i];
|
||||
std::unique_lock guard(frameCacheMutex);
|
||||
auto it = frameCache.find(addr);
|
||||
bool found = it != frameCache.end();
|
||||
guard.unlock();
|
||||
if( found )
|
||||
bool found = false;
|
||||
{
|
||||
frameData[ i ].info = it->second;
|
||||
frameData[ i ].handled = true;
|
||||
// The cache evicts its oldest entry when a new one arrives, so copy the string out
|
||||
// while the lock is held.
|
||||
std::lock_guard guard(frameCacheMutex);
|
||||
auto it = frameCache.find(addr);
|
||||
if (it != frameCache.end())
|
||||
{
|
||||
frameData[ i ].info = it->second;
|
||||
frameData[ i ].handled = true;
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
else if (dladdr(addr, &dli) != 0)
|
||||
if (!found && dladdr(addr, &dli) != 0)
|
||||
{
|
||||
if (dli.dli_fname && dli.dli_fbase)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user