Workaround for wxString's lack of thread safety.
This commit is contained in:
parent
611d5a0dc4
commit
db73daa09c
|
@ -405,6 +405,10 @@ void TEXTE_PCB::TransformBoundingBoxWithClearanceToPolygon(
|
||||||
SHAPE_POLY_SET& aCornerBuffer,
|
SHAPE_POLY_SET& aCornerBuffer,
|
||||||
int aClearanceValue ) const
|
int aClearanceValue ) const
|
||||||
{
|
{
|
||||||
|
// Oh dear. 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 );
|
||||||
|
|
||||||
if( GetText().Length() == 0 )
|
if( GetText().Length() == 0 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
@ -40,6 +40,17 @@ class EDA_DRAW_PANEL;
|
||||||
class MSG_PANEL_ITEM;
|
class MSG_PANEL_ITEM;
|
||||||
|
|
||||||
|
|
||||||
|
// A mutex which is unique to each instance it appears in (ie: a new std::mutex is allocated
|
||||||
|
// on copy or assignment).
|
||||||
|
class UNIQUE_MUTEX : public std::mutex
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
UNIQUE_MUTEX() : std::mutex() {}
|
||||||
|
UNIQUE_MUTEX( const UNIQUE_MUTEX& ) : std::mutex() {}
|
||||||
|
UNIQUE_MUTEX& operator= (const UNIQUE_MUTEX& ) { return *this; }
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
class TEXTE_PCB : public BOARD_ITEM, public EDA_TEXT
|
class TEXTE_PCB : public BOARD_ITEM, public EDA_TEXT
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -142,6 +153,8 @@ public:
|
||||||
|
|
||||||
virtual void SwapData( BOARD_ITEM* aImage ) override;
|
virtual void SwapData( BOARD_ITEM* aImage ) override;
|
||||||
|
|
||||||
|
mutable UNIQUE_MUTEX m_mutex;
|
||||||
|
|
||||||
#if defined(DEBUG)
|
#if defined(DEBUG)
|
||||||
virtual void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
|
virtual void Show( int nestLevel, std::ostream& os ) const override { ShowDummy( os ); }
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue