mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-09-14 02:03:12 +02:00
Shutdown safety. (Potentially KICAD-TJK.)
This commit is contained in:
parent
cef15bcf30
commit
479daa37c5
@ -290,6 +290,9 @@ void LIB_TREE::ShutdownPreviews()
|
|||||||
|
|
||||||
if( m_previewWindow )
|
if( m_previewWindow )
|
||||||
{
|
{
|
||||||
|
// Shutdown the preview window's canvas
|
||||||
|
m_adapter->ShutdownPreview( m_previewWindow );
|
||||||
|
|
||||||
m_previewWindow->Hide();
|
m_previewWindow->Hide();
|
||||||
m_previewWindow->Destroy();
|
m_previewWindow->Destroy();
|
||||||
m_previewWindow = nullptr;
|
m_previewWindow = nullptr;
|
||||||
|
@ -55,7 +55,6 @@ public:
|
|||||||
|
|
||||||
SCH_RENDER_SETTINGS* GetRenderSettings() const;
|
SCH_RENDER_SETTINGS* GetRenderSettings() const;
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
void onPaint( wxPaintEvent& WXUNUSED( aEvent ) ) override;
|
void onPaint( wxPaintEvent& WXUNUSED( aEvent ) ) override;
|
||||||
|
@ -381,11 +381,12 @@ bool SYMBOL_TREE_SYNCHRONIZING_ADAPTER::HasPreview( const wxDataViewItem& aItem
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static const wxString c_previewName = wxS( "symHoverPreview" );
|
||||||
|
|
||||||
|
|
||||||
void SYMBOL_TREE_SYNCHRONIZING_ADAPTER::ShowPreview( wxWindow* aParent,
|
void SYMBOL_TREE_SYNCHRONIZING_ADAPTER::ShowPreview( wxWindow* aParent,
|
||||||
const wxDataViewItem& aItem )
|
const wxDataViewItem& aItem )
|
||||||
{
|
{
|
||||||
static const wxString c_previewName = wxS( "symHoverPreview" );
|
|
||||||
|
|
||||||
LIB_TREE_NODE* node = ToNode( aItem );
|
LIB_TREE_NODE* node = ToNode( aItem );
|
||||||
wxCHECK( node, /* void */ );
|
wxCHECK( node, /* void */ );
|
||||||
|
|
||||||
@ -416,3 +417,15 @@ void SYMBOL_TREE_SYNCHRONIZING_ADAPTER::ShowPreview( wxWindow* aPare
|
|||||||
|
|
||||||
preview->DisplaySymbol( node->m_LibId, node->m_Unit );
|
preview->DisplaySymbol( node->m_LibId, node->m_Unit );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void SYMBOL_TREE_SYNCHRONIZING_ADAPTER::ShutdownPreview( wxWindow* aParent )
|
||||||
|
{
|
||||||
|
wxWindow* previewWindow = wxWindow::FindWindowByName( c_previewName, aParent );
|
||||||
|
|
||||||
|
if( SYMBOL_PREVIEW_WIDGET* preview = dynamic_cast<SYMBOL_PREVIEW_WIDGET*>( previewWindow ) )
|
||||||
|
{
|
||||||
|
preview->GetCanvas()->SetEvtHandlerEnabled( false );
|
||||||
|
preview->GetCanvas()->StopDrawing();
|
||||||
|
}
|
||||||
|
}
|
@ -50,8 +50,9 @@ public:
|
|||||||
|
|
||||||
wxDataViewItem GetCurrentDataViewItem() override;
|
wxDataViewItem GetCurrentDataViewItem() override;
|
||||||
|
|
||||||
virtual bool HasPreview( const wxDataViewItem& aItem ) override;
|
bool HasPreview( const wxDataViewItem& aItem ) override;
|
||||||
virtual void ShowPreview( wxWindow* aParent, const wxDataViewItem& aItem ) override;
|
void ShowPreview( wxWindow* aParent, const wxDataViewItem& aItem ) override;
|
||||||
|
void ShutdownPreview( wxWindow* aParent ) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void updateLibrary( LIB_TREE_NODE_LIBRARY& aLibNode );
|
void updateLibrary( LIB_TREE_NODE_LIBRARY& aLibNode );
|
||||||
|
@ -60,6 +60,8 @@ public:
|
|||||||
|
|
||||||
void DisplayPart( LIB_SYMBOL* aSymbol, int aUnit, int aBodyStyle = 0 );
|
void DisplayPart( LIB_SYMBOL* aSymbol, int aUnit, int aBodyStyle = 0 );
|
||||||
|
|
||||||
|
EDA_DRAW_PANEL_GAL* GetCanvas() const { return m_preview; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void onSize( wxSizeEvent& aEvent );
|
void onSize( wxSizeEvent& aEvent );
|
||||||
|
|
||||||
|
@ -265,6 +265,7 @@ public:
|
|||||||
|
|
||||||
virtual bool HasPreview( const wxDataViewItem& aItem ) { return false; }
|
virtual bool HasPreview( const wxDataViewItem& aItem ) { return false; }
|
||||||
virtual void ShowPreview( wxWindow* aParent, const wxDataViewItem& aItem ) {}
|
virtual void ShowPreview( wxWindow* aParent, const wxDataViewItem& aItem ) {}
|
||||||
|
virtual void ShutdownPreview( wxWindow* aParent ) {}
|
||||||
|
|
||||||
TOOL_DISPATCHER* GetToolDispatcher() const { return m_parent->GetToolDispatcher(); }
|
TOOL_DISPATCHER* GetToolDispatcher() const { return m_parent->GetToolDispatcher(); }
|
||||||
|
|
||||||
|
@ -333,10 +333,11 @@ bool FP_TREE_SYNCHRONIZING_ADAPTER::HasPreview( const wxDataViewItem& aItem )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static const wxString c_previewName = wxS( "fpHoverPreview" );
|
||||||
|
|
||||||
|
|
||||||
void FP_TREE_SYNCHRONIZING_ADAPTER::ShowPreview( wxWindow* aParent, const wxDataViewItem& aItem )
|
void FP_TREE_SYNCHRONIZING_ADAPTER::ShowPreview( wxWindow* aParent, const wxDataViewItem& aItem )
|
||||||
{
|
{
|
||||||
static const wxString c_previewName = wxS( "fpHoverPreview" );
|
|
||||||
|
|
||||||
LIB_TREE_NODE* node = ToNode( aItem );
|
LIB_TREE_NODE* node = ToNode( aItem );
|
||||||
wxCHECK( node, /* void */ );
|
wxCHECK( node, /* void */ );
|
||||||
|
|
||||||
@ -358,4 +359,16 @@ void FP_TREE_SYNCHRONIZING_ADAPTER::ShowPreview( wxWindow* aParent, const wxData
|
|||||||
}
|
}
|
||||||
|
|
||||||
preview->DisplayFootprint( node->m_LibId );
|
preview->DisplayFootprint( node->m_LibId );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void FP_TREE_SYNCHRONIZING_ADAPTER::ShutdownPreview( wxWindow* aParent )
|
||||||
|
{
|
||||||
|
wxWindow* previewWindow = wxWindow::FindWindowByName( c_previewName, aParent );
|
||||||
|
|
||||||
|
if( FOOTPRINT_PREVIEW_PANEL* preview = dynamic_cast<FOOTPRINT_PREVIEW_PANEL*>( previewWindow ) )
|
||||||
|
{
|
||||||
|
preview->GetCanvas()->SetEvtHandlerEnabled( false );
|
||||||
|
preview->GetCanvas()->StopDrawing();
|
||||||
|
}
|
||||||
}
|
}
|
@ -46,8 +46,9 @@ public:
|
|||||||
|
|
||||||
wxDataViewItem GetCurrentDataViewItem() override;
|
wxDataViewItem GetCurrentDataViewItem() override;
|
||||||
|
|
||||||
virtual bool HasPreview( const wxDataViewItem& aItem ) override;
|
bool HasPreview( const wxDataViewItem& aItem ) override;
|
||||||
virtual void ShowPreview( wxWindow* aParent, const wxDataViewItem& aItem ) override;
|
void ShowPreview( wxWindow* aParent, const wxDataViewItem& aItem ) override;
|
||||||
|
void ShutdownPreview( wxWindow* aParent ) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
FP_TREE_SYNCHRONIZING_ADAPTER( FOOTPRINT_EDIT_FRAME* aFrame, FP_LIB_TABLE* aLibs );
|
FP_TREE_SYNCHRONIZING_ADAPTER( FOOTPRINT_EDIT_FRAME* aFrame, FP_LIB_TABLE* aLibs );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user