From 82ae9db2626619d3d5ba6ff96f70078caf6f5888 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Wed, 26 Feb 2020 17:56:47 +0000 Subject: [PATCH] Another variation on the wxDataViewCtrl issue.... --- pcbnew/dialogs/dialog_cleanup_tracks_and_vias.cpp | 1 - pcbnew/dialogs/dialog_drc.cpp | 3 --- pcbnew/drc/drc_tree_model.h | 13 +++++++++++-- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/pcbnew/dialogs/dialog_cleanup_tracks_and_vias.cpp b/pcbnew/dialogs/dialog_cleanup_tracks_and_vias.cpp index de7a4aad35..aee5a475f2 100644 --- a/pcbnew/dialogs/dialog_cleanup_tracks_and_vias.cpp +++ b/pcbnew/dialogs/dialog_cleanup_tracks_and_vias.cpp @@ -46,7 +46,6 @@ DIALOG_CLEANUP_TRACKS_AND_VIAS::DIALOG_CLEANUP_TRACKS_AND_VIAS( PCB_EDIT_FRAME* m_cleanShortCircuitOpt->SetValue( cfg->m_Cleanup.cleanup_short_circuits ); m_deleteTracksInPadsOpt->SetValue( cfg->m_Cleanup.cleanup_tracks_in_pad ); - m_changesDataView->AppendTextColumn( wxEmptyString, 0, wxDATAVIEW_CELL_INERT, 4000 ); m_changesTreeModel = new DRC_TREE_MODEL( m_changesDataView ); m_changesDataView->AssociateModel( m_changesTreeModel ); diff --git a/pcbnew/dialogs/dialog_drc.cpp b/pcbnew/dialogs/dialog_drc.cpp index 34a3631204..37b31d983e 100644 --- a/pcbnew/dialogs/dialog_drc.cpp +++ b/pcbnew/dialogs/dialog_drc.cpp @@ -55,15 +55,12 @@ DIALOG_DRC_CONTROL::DIALOG_DRC_CONTROL( DRC* aTester, PCB_EDIT_FRAME* aEditorFra m_BrowseButton->SetBitmap( KiBitmap( folder_xpm ) ); - m_markerDataView->AppendTextColumn( wxEmptyString, 0, wxDATAVIEW_CELL_INERT, 4000 ); m_markerTreeModel = new DRC_TREE_MODEL( m_markerDataView ); m_markerDataView->AssociateModel( m_markerTreeModel ); - m_unconnectedDataView->AppendTextColumn( wxEmptyString, 0, wxDATAVIEW_CELL_INERT, 4000 ); m_unconnectedTreeModel = new DRC_TREE_MODEL( m_unconnectedDataView ); m_unconnectedDataView->AssociateModel( m_unconnectedTreeModel ); - m_footprintsDataView->AppendTextColumn( wxEmptyString, 0, wxDATAVIEW_CELL_INERT, 4000 ); m_footprintsTreeModel = new DRC_TREE_MODEL( m_footprintsDataView ); m_footprintsDataView->AssociateModel( m_footprintsTreeModel ); diff --git a/pcbnew/drc/drc_tree_model.h b/pcbnew/drc/drc_tree_model.h index ebfe881d1c..c84cf91145 100644 --- a/pcbnew/drc/drc_tree_model.h +++ b/pcbnew/drc/drc_tree_model.h @@ -232,7 +232,7 @@ public: // on a row that has been deleted. m_view->UnselectAll(); - BeforeReset(); + Cleared(); delete m_drcItemsProvider; m_drcItemsProvider = aProvider; @@ -251,7 +251,16 @@ public: node.m_Children.emplace_back( &node, drcItem, DRC_TREE_NODE::AUX_ITEM ); } - AfterReset(); +#if defined( __LINUX__ ) + // The fastest method to update wxDataViewCtrl is to rebuild from + // scratch by calling Cleared(). Linux requires to reassociate model to + // display data, but Windows will create multiple associations. + // On MacOS, this crashes kicad. See https://gitlab.com/kicad/code/kicad/issues/3666 + // and https://gitlab.com/kicad/code/kicad/issues/3653 + m_view->AssociateModel( this ); +#endif + m_view->ClearColumns(); + m_view->AppendTextColumn( wxEmptyString, 0, wxDATAVIEW_CELL_INERT, 4000 ); ExpandAll(); }