SCH_PIN: Guard the calculated map

Pins are used in threaded application so we need to keep the
precalculation map guarded
This commit is contained in:
Seth Hillbrand 2019-04-09 22:29:00 -07:00
parent 1a031e771f
commit 1c93b122f1
2 changed files with 6 additions and 0 deletions

View File

@ -67,6 +67,8 @@ wxString SCH_PIN::GetDefaultNetName( const SCH_SHEET_PATH aPath )
if( m_pin->IsPowerConnection() )
return m_pin->GetName();
std::lock_guard<std::mutex> lock( m_netmap_mutex );
if( m_net_name_map.count( aPath ) > 0 )
return m_net_name_map.at( aPath );

View File

@ -26,6 +26,9 @@
#include <sch_sheet_path.h>
#include <lib_pin.h>
#include <mutex>
#include <map>
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<const SCH_SHEET_PATH, wxString> m_net_name_map;
public: