Browse Source

Attempt to fix destruction order crash (KICAD-6KC).

(cherry picked from commit a7fdea9b6f)
9.0
Jeff Young 4 months ago
parent
commit
aacfa5ab83
  1. 27
      common/widgets/lib_tree.cpp
  2. 3
      eeschema/symbol_editor/symbol_edit_frame.cpp
  3. 3
      include/widgets/lib_tree.h
  4. 3
      pcbnew/footprint_edit_frame.cpp

27
common/widgets/lib_tree.cpp

@ -278,7 +278,20 @@ LIB_TREE::~LIB_TREE()
m_details_ctrl->Unbind( wxEVT_HTML_LINK_CLICKED, &LIB_TREE::onDetailsLink, this );
m_hoverTimer.Stop();
destroyPreview();
}
void LIB_TREE::ShutdownPreviews()
{
m_hoverTimer.Stop();
m_previewDisabled = true;
if( m_previewWindow )
{
m_previewWindow->Hide();
m_previewWindow->Destroy();
m_previewWindow = nullptr;
}
}
@ -751,18 +764,6 @@ void LIB_TREE::hidePreview()
}
void LIB_TREE::destroyPreview()
{
hidePreview();
if( m_previewWindow )
{
m_previewWindow->Destroy();
m_previewWindow = nullptr;
}
}
void LIB_TREE::onIdle( wxIdleEvent& aEvent )
{
// The wxDataViewCtrl won't give us its mouseMoved events so we're forced to use idle

3
eeschema/symbol_editor/symbol_edit_frame.cpp

@ -688,6 +688,9 @@ bool SYMBOL_EDIT_FRAME::canCloseWindow( wxCloseEvent& aEvent )
void SYMBOL_EDIT_FRAME::doCloseWindow()
{
if( GetLibTree() )
GetLibTree()->ShutdownPreviews();
Destroy();
}

3
include/widgets/lib_tree.h

@ -180,6 +180,8 @@ public:
m_previewDisabled = aBlock;
}
void ShutdownPreviews();
protected:
/**
* Expand or collapse a node, switching it to the opposite state.
@ -232,7 +234,6 @@ protected:
void showPreview( wxDataViewItem aItem );
void hidePreview();
void destroyPreview();
void onQueryText( wxCommandEvent& aEvent );
void onQueryCharHook( wxKeyEvent& aEvent );

3
pcbnew/footprint_edit_frame.cpp

@ -941,6 +941,9 @@ void FOOTPRINT_EDIT_FRAME::doCloseWindow()
GetCanvas()->SetEventDispatcher( nullptr );
GetCanvas()->StopDrawing();
if( GetLibTree() )
GetLibTree()->ShutdownPreviews();
// Do not show the layer manager during closing to avoid flicker
// on some platforms (Windows) that generate useless redraw of items in
// the Layer Manager

Loading…
Cancel
Save