Add thread-safety to SCH_FIELD::IsVoid()
Fixes: lp:1822678 * https://bugs.launchpad.net/kicad/+bug/1822678
This commit is contained in:
parent
9e240db80c
commit
948a61711d
|
@ -312,6 +312,18 @@ bool SCH_FIELD::IsHorizJustifyFlipped() const
|
|||
}
|
||||
|
||||
|
||||
bool SCH_FIELD::IsVoid() const
|
||||
{
|
||||
// When in UTF-8 mode, wxString puts string iterators in a linked list, and
|
||||
// that linked list is not thread-safe.
|
||||
std::lock_guard<std::mutex> guard( m_mutex );
|
||||
|
||||
size_t len = m_Text.Len();
|
||||
|
||||
return len == 0 || ( len == 1 && m_Text[0] == wxChar( '~' ) );
|
||||
}
|
||||
|
||||
|
||||
void SCH_FIELD::Place( SCH_EDIT_FRAME* frame, wxDC* DC )
|
||||
{
|
||||
frame->GetCanvas()->SetMouseCapture( NULL, NULL );
|
||||
|
|
|
@ -59,6 +59,8 @@ class SCH_FIELD : public SCH_ITEM, public EDA_TEXT
|
|||
|
||||
wxString m_name;
|
||||
|
||||
mutable UNIQUE_MUTEX m_mutex;
|
||||
|
||||
public:
|
||||
SCH_FIELD( const wxPoint& aPos, int aFieldId, SCH_COMPONENT* aParent,
|
||||
const wxString& aName = wxEmptyString );
|
||||
|
@ -113,12 +115,7 @@ public:
|
|||
* Function IsVoid
|
||||
* returns true if the field is either empty or holds "~".
|
||||
*/
|
||||
bool IsVoid() const
|
||||
{
|
||||
size_t len = m_Text.Len();
|
||||
|
||||
return len == 0 || ( len == 1 && m_Text[0] == wxChar( '~' ) );
|
||||
}
|
||||
bool IsVoid() const;
|
||||
|
||||
void SwapData( SCH_ITEM* aItem ) override;
|
||||
|
||||
|
|
Loading…
Reference in New Issue