From 1c93b122f104e667eecabf190c9e0244229938bb Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Tue, 9 Apr 2019 22:29:00 -0700 Subject: [PATCH] SCH_PIN: Guard the calculated map Pins are used in threaded application so we need to keep the precalculation map guarded --- eeschema/sch_pin.cpp | 2 ++ eeschema/sch_pin.h | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/eeschema/sch_pin.cpp b/eeschema/sch_pin.cpp index d85a48ee5d..301b11f4f9 100644 --- a/eeschema/sch_pin.cpp +++ b/eeschema/sch_pin.cpp @@ -67,6 +67,8 @@ wxString SCH_PIN::GetDefaultNetName( const SCH_SHEET_PATH aPath ) if( m_pin->IsPowerConnection() ) return m_pin->GetName(); + std::lock_guard lock( m_netmap_mutex ); + if( m_net_name_map.count( aPath ) > 0 ) return m_net_name_map.at( aPath ); diff --git a/eeschema/sch_pin.h b/eeschema/sch_pin.h index d879444d38..d2a976db97 100644 --- a/eeschema/sch_pin.h +++ b/eeschema/sch_pin.h @@ -26,6 +26,9 @@ #include #include +#include +#include + class SCH_COMPONENT; class SCH_PIN : public SCH_ITEM @@ -37,6 +40,7 @@ class SCH_PIN : public SCH_ITEM bool m_isDangling; /// The name that this pin connection will drive onto a net + std::mutex m_netmap_mutex; std::map m_net_name_map; public: