From 33f004c5a67cdacd810f47a97b6716f9bf7988a0 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Sun, 8 Jun 2025 11:38:11 +0100 Subject: [PATCH] Lock safety. We're going to grab the lock every time through anyway, might as well have it for the reads as well as the writes. (cherry picked from commit 95ab9f0b50b677a022d4d94edae1b616a1d86fcd) --- pcbnew/tracks_cleaner.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pcbnew/tracks_cleaner.cpp b/pcbnew/tracks_cleaner.cpp index bb7150a74e..a2aaa1851b 100644 --- a/pcbnew/tracks_cleaner.cpp +++ b/pcbnew/tracks_cleaner.cpp @@ -631,8 +631,9 @@ const std::vector& TRACKS_CLEANER::getConnectedItems( PCB PCB_ZONE_T }; const std::shared_ptr& connectivity = m_brd->GetConnectivity(); + std::lock_guard lock( m_mutex ); - if( std::lock_guard lock( m_mutex ); !m_connectedItemsCache.contains( aTrack ) ) + if( !m_connectedItemsCache.contains( aTrack ) ) m_connectedItemsCache[aTrack] = connectivity->GetConnectedItems( aTrack, connectedTypes ); return m_connectedItemsCache.at( aTrack );