Unselect and freeze before starting reset
In some cases, the BeforeReset() will cause an iteration over the tree
elements. If we have deleted an element before doing this, we risk a
corruption/crash.
Fixes https://gitlab.com/kicad/code/kicad/issues/6192
(cherry picked from commit 3bd080b64e
)
This commit is contained in:
parent
67c8071bf4
commit
73bf4cbce7
|
@ -144,7 +144,6 @@ void LIB_TREE_MODEL_ADAPTER::UpdateSearchString( wxString const& aSearch )
|
||||||
// not return invalid data to the UI, since this invalid data can cause crashes.
|
// not return invalid data to the UI, since this invalid data can cause crashes.
|
||||||
// This is different than the update locker, which locks the UI aspects only.
|
// This is different than the update locker, which locks the UI aspects only.
|
||||||
wxWindowUpdateLocker updateLock( m_widget );
|
wxWindowUpdateLocker updateLock( m_widget );
|
||||||
BeforeReset();
|
|
||||||
|
|
||||||
// Even with the updateLock, wxWidgets sometimes ties its knickers in
|
// Even with the updateLock, wxWidgets sometimes ties its knickers in
|
||||||
// a knot when trying to run a wxdataview_selection_changed_callback()
|
// a knot when trying to run a wxdataview_selection_changed_callback()
|
||||||
|
@ -152,6 +151,7 @@ void LIB_TREE_MODEL_ADAPTER::UpdateSearchString( wxString const& aSearch )
|
||||||
// https://bugs.launchpad.net/kicad/+bug/1756255
|
// https://bugs.launchpad.net/kicad/+bug/1756255
|
||||||
m_widget->UnselectAll();
|
m_widget->UnselectAll();
|
||||||
Freeze();
|
Freeze();
|
||||||
|
BeforeReset();
|
||||||
|
|
||||||
m_tree.ResetScore();
|
m_tree.ResetScore();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue