eeschema: lock model while updating scores
The tree model adapter appears to have update issues when modifying the scores while it _might_ get updated. This moves the lock higher and removes the extraneous Freeze/Thaw call. Unfortunately, this only exposes an additional issue in the tool handler but this will hopefully be easier to debug. Fixes https://gitlab.com/kicad/code/kicad/issues/5206
This commit is contained in:
parent
e2bdd34d82
commit
6b0176d577
|
@ -188,38 +188,35 @@ void LIB_TREE_MODEL_ADAPTER::DoAddLibrary( wxString const& aNodeName, wxString c
|
||||||
|
|
||||||
void LIB_TREE_MODEL_ADAPTER::UpdateSearchString( wxString const& aSearch )
|
void LIB_TREE_MODEL_ADAPTER::UpdateSearchString( wxString const& aSearch )
|
||||||
{
|
{
|
||||||
m_tree.ResetScore();
|
|
||||||
|
|
||||||
for( auto& child: m_tree.m_Children )
|
|
||||||
{
|
|
||||||
if( child->m_Pinned )
|
|
||||||
child->m_Score *= 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
wxStringTokenizer tokenizer( aSearch );
|
|
||||||
|
|
||||||
while( tokenizer.HasMoreTokens() )
|
|
||||||
{
|
|
||||||
const wxString term = tokenizer.GetNextToken().Lower();
|
|
||||||
EDA_COMBINED_MATCHER matcher( term );
|
|
||||||
|
|
||||||
m_tree.UpdateScore( matcher );
|
|
||||||
}
|
|
||||||
|
|
||||||
m_tree.SortNodes();
|
|
||||||
|
|
||||||
{
|
{
|
||||||
wxWindowUpdateLocker updateLock( m_widget );
|
wxWindowUpdateLocker updateLock( m_widget );
|
||||||
|
|
||||||
Freeze();
|
m_tree.ResetScore();
|
||||||
|
|
||||||
|
for( auto& child: m_tree.m_Children )
|
||||||
|
{
|
||||||
|
if( child->m_Pinned )
|
||||||
|
child->m_Score *= 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
wxStringTokenizer tokenizer( aSearch );
|
||||||
|
|
||||||
|
while( tokenizer.HasMoreTokens() )
|
||||||
|
{
|
||||||
|
const wxString term = tokenizer.GetNextToken().Lower();
|
||||||
|
EDA_COMBINED_MATCHER matcher( term );
|
||||||
|
|
||||||
|
m_tree.UpdateScore( matcher );
|
||||||
|
}
|
||||||
|
|
||||||
// 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()
|
||||||
// on a row that has been deleted.
|
// on a row that has been deleted.
|
||||||
// https://bugs.launchpad.net/kicad/+bug/1756255
|
// https://bugs.launchpad.net/kicad/+bug/1756255
|
||||||
m_widget->UnselectAll();
|
m_widget->UnselectAll();
|
||||||
|
|
||||||
|
m_tree.SortNodes();
|
||||||
Cleared();
|
Cleared();
|
||||||
Thaw();
|
|
||||||
|
|
||||||
// This was fixed in wxWidgets 3.0.5 and 3.1.3.
|
// This was fixed in wxWidgets 3.0.5 and 3.1.3.
|
||||||
#if defined( __WXGTK__ ) && ( (wxVERSION_NUMBER < 030005 ) || \
|
#if defined( __WXGTK__ ) && ( (wxVERSION_NUMBER < 030005 ) || \
|
||||||
|
|
Loading…
Reference in New Issue