Keep the default net class object per board, not static

Fixes: lp:1711491
* https://bugs.launchpad.net/kicad/+bug/1711491
This commit is contained in:
Maciej Suminski 2017-08-31 17:45:17 +02:00
parent bd64b70f0b
commit 450f006d7d
3 changed files with 7 additions and 4 deletions

View File

@ -188,7 +188,6 @@ private:
int m_fileFormatVersionAtLoad; ///< the version loaded from the file int m_fileFormatVersionAtLoad; ///< the version loaded from the file
NETINFO_LIST m_NetInfo; ///< net info list (name, design constraints ..
std::shared_ptr<CONNECTIVITY_DATA> m_connectivity; std::shared_ptr<CONNECTIVITY_DATA> m_connectivity;
BOARD_DESIGN_SETTINGS m_designSettings; BOARD_DESIGN_SETTINGS m_designSettings;
@ -197,6 +196,7 @@ private:
PAGE_INFO m_paper; PAGE_INFO m_paper;
TITLE_BLOCK m_titles; ///< text in lower right of screen and plots TITLE_BLOCK m_titles; ///< text in lower right of screen and plots
PCB_PLOT_PARAMS m_plotOptions; PCB_PLOT_PARAMS m_plotOptions;
NETINFO_LIST m_NetInfo; ///< net info list (name, design constraints ..
/** /**
* Function chainMarkedSegments * Function chainMarkedSegments

View File

@ -86,6 +86,7 @@ NETCLASS::~NETCLASS()
NETCLASSES::NETCLASSES() NETCLASSES::NETCLASSES()
{ {
m_default = std::make_shared<NETCLASS>( NETCLASS::Default );
} }

View File

@ -235,6 +235,9 @@ private:
/// all the NETCLASSes except the default one. /// all the NETCLASSes except the default one.
NETCLASS_MAP m_NetClasses; NETCLASS_MAP m_NetClasses;
/// the default NETCLASS
NETCLASSPTR m_default;
public: public:
NETCLASSES(); NETCLASSES();
~NETCLASSES(); ~NETCLASSES();
@ -269,10 +272,9 @@ public:
* Function GetDefault * Function GetDefault
* @return the default net class. * @return the default net class.
*/ */
NETCLASSPTR& GetDefault() const NETCLASSPTR GetDefault() const
{ {
static NETCLASSPTR defNetClass = std::make_shared<NETCLASS>( NETCLASS::Default ); return m_default;
return defNetClass;
} }
/** /**