Drop the unique_ptr for m_spaceMouse since it can't be forward declared

Also we probably don't want to leak that class header everywhere
This commit is contained in:
Marek Roszko 2022-08-20 09:48:48 -04:00
parent 59d2c4339f
commit 7daded7c60
2 changed files with 14 additions and 5 deletions

View File

@ -86,7 +86,8 @@ SCH_BASE_FRAME::SCH_BASE_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aWindo
const wxSize& aSize, long aStyle, const wxString& aFrameName ) : const wxSize& aSize, long aStyle, const wxString& aFrameName ) :
EDA_DRAW_FRAME( aKiway, aParent, aWindowType, aTitle, aPosition, aSize, aStyle, EDA_DRAW_FRAME( aKiway, aParent, aWindowType, aTitle, aPosition, aSize, aStyle,
aFrameName ), aFrameName ),
m_base_frame_defaults( nullptr, "base_Frame_defaults" ) m_base_frame_defaults( nullptr, "base_Frame_defaults" ),
m_spaceMouse( nullptr )
{ {
createCanvas(); createCanvas();
@ -106,6 +107,15 @@ SCH_BASE_FRAME::SCH_BASE_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aWindo
} }
SCH_BASE_FRAME::~SCH_BASE_FRAME()
{
#if defined( KICAD_USE_3DCONNEXION )
if( m_spaceMouse != nullptr )
delete m_spaceMouse;
#endif
}
SCH_SCREEN* SCH_BASE_FRAME::GetScreen() const SCH_SCREEN* SCH_BASE_FRAME::GetScreen() const
{ {
return (SCH_SCREEN*) EDA_DRAW_FRAME::GetScreen(); return (SCH_SCREEN*) EDA_DRAW_FRAME::GetScreen();
@ -294,7 +304,7 @@ void SCH_BASE_FRAME::ActivateGalCanvas()
{ {
if( !m_spaceMouse ) if( !m_spaceMouse )
{ {
m_spaceMouse = std::make_unique<NL_SCHEMATIC_PLUGIN>(); m_spaceMouse = new NL_SCHEMATIC_PLUGIN();
} }
m_spaceMouse->SetCanvas( GetCanvas() ); m_spaceMouse->SetCanvas( GetCanvas() );

View File

@ -96,8 +96,7 @@ public:
const wxPoint& aPosition, const wxSize& aSize, long aStyle, const wxPoint& aPosition, const wxSize& aSize, long aStyle,
const wxString & aFrameName ); const wxString & aFrameName );
virtual ~SCH_BASE_FRAME() virtual ~SCH_BASE_FRAME();
{ }
void createCanvas(); void createCanvas();
@ -264,7 +263,7 @@ protected:
private: private:
#if defined( KICAD_USE_3DCONNEXION ) #if defined( KICAD_USE_3DCONNEXION )
std::unique_ptr<NL_SCHEMATIC_PLUGIN> m_spaceMouse; NL_SCHEMATIC_PLUGIN* m_spaceMouse;
#endif #endif
}; };