Remove a bunch of ugly mutex hacks now that we don't use wxString's UTF8 mode anymore.
This commit is contained in:
parent
64b18ea06a
commit
6fab7cc025
|
@ -74,10 +74,6 @@ EDA_ITEM* SCH_FIELD::Clone() const
|
|||
|
||||
const wxString SCH_FIELD::GetFullyQualifiedText() 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 );
|
||||
|
||||
wxString text = m_Text;
|
||||
|
||||
/* For more than one part per package, we must add the part selection
|
||||
|
@ -97,36 +93,6 @@ const wxString SCH_FIELD::GetFullyQualifiedText() const
|
|||
}
|
||||
|
||||
|
||||
const wxString SCH_FIELD::GetText() 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 );
|
||||
|
||||
return m_Text;
|
||||
}
|
||||
|
||||
|
||||
wxString SCH_FIELD::GetShownText() 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 );
|
||||
|
||||
return m_Text;
|
||||
}
|
||||
|
||||
|
||||
void SCH_FIELD::SetText( const wxString& aText )
|
||||
{
|
||||
// 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 );
|
||||
|
||||
m_Text = aText;
|
||||
}
|
||||
|
||||
|
||||
int SCH_FIELD::GetPenSize() const
|
||||
{
|
||||
int pensize = GetThickness();
|
||||
|
@ -291,10 +257,6 @@ 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 );
|
||||
|
||||
return m_Text.Len() == 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -55,8 +55,6 @@ 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 );
|
||||
|
@ -106,10 +104,6 @@ public:
|
|||
|
||||
void SetId( int aId ) { m_id = aId; }
|
||||
|
||||
const wxString GetText() const override;
|
||||
wxString GetShownText() const override;
|
||||
void SetText( const wxString& aText ) override;
|
||||
|
||||
/**
|
||||
* Function GetFullyQualifiedText
|
||||
* returns the fully qualified field text by allowing for the part suffix to be added
|
||||
|
|
|
@ -22,36 +22,17 @@
|
|||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file eda_text.h
|
||||
* @brief Definition of base KiCad text object.
|
||||
*/
|
||||
|
||||
#ifndef EDA_TEXT_H_
|
||||
#define EDA_TEXT_H_
|
||||
|
||||
#include <mutex>
|
||||
#include <trigo.h> // NORMALIZE_ANGLE_POS( angle );
|
||||
#include <common.h> // wxStringSplit
|
||||
#include <gr_basic.h> // EDA_DRAW_MODE_T
|
||||
#include <base_struct.h> // EDA_RECT
|
||||
|
||||
#include <mutex>
|
||||
#include "kicad_string.h"
|
||||
|
||||
class SHAPE_POLY_SET;
|
||||
|
||||
// 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; }
|
||||
};
|
||||
|
||||
|
||||
// part of the kicad_plugin.h family of defines.
|
||||
// See kicad_plugin.h for the choice of the value
|
||||
// When set when calling EDA_TEXT::Format, disable writing the "hide" keyword in save file
|
||||
|
@ -139,12 +120,8 @@ public:
|
|||
* returns the string associated with the text object.
|
||||
*
|
||||
* @return a const wxString reference containing the string of the item.
|
||||
*
|
||||
* WARNING: this routine MUST NOT return a reference!
|
||||
* While it would be faster, it would also defeat the use of RAII mutex locks
|
||||
* in subclasses to get around wxString's multi-threading bugs in UTF-8 mode.
|
||||
*/
|
||||
virtual const wxString/* & forbidden */ GetText() const { return m_Text; }
|
||||
virtual const wxString& GetText() const { return m_Text; }
|
||||
|
||||
/**
|
||||
* Returns the string actually shown after processing of the base
|
||||
|
@ -375,9 +352,6 @@ protected:
|
|||
/// Cache of unescaped text for efficient access
|
||||
wxString m_shown_text;
|
||||
|
||||
// wxString isn't thread-safe, so make use of this in multi-threaded situations
|
||||
mutable UNIQUE_MUTEX m_mutex;
|
||||
|
||||
private:
|
||||
/**
|
||||
* Function printOneLineOfText
|
||||
|
|
|
@ -350,10 +350,6 @@ void ZONE_CONTAINER::TransformSolidAreasShapesToPolygonSet(
|
|||
void EDA_TEXT::TransformBoundingBoxWithClearanceToPolygon(
|
||||
SHAPE_POLY_SET* aCornerBuffer, 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 )
|
||||
return;
|
||||
|
||||
|
|
|
@ -24,7 +24,6 @@
|
|||
*/
|
||||
#include <cstdint>
|
||||
#include <thread>
|
||||
#include <mutex>
|
||||
#include <functional>
|
||||
#include "pcb_editor_control.h"
|
||||
#include "pcb_actions.h"
|
||||
|
|
Loading…
Reference in New Issue