Fix random node selection in symbol library editor on Windows

Selecting a node while wxDataViewCtrl is frozen selects a random node on
Windows.

Fixes: lp:1739202
* https://bugs.launchpad.net/kicad/+bug/1739202
This commit is contained in:
Maciej Suminski 2017-12-20 12:05:25 +01:00
parent 457bbbed15
commit 6344e238b3
1 changed files with 5 additions and 2 deletions

View File

@ -31,7 +31,6 @@
#include <wx/sizer.h>
#include <wx/statbmp.h>
#include <wx/html/htmlwin.h>
#include <wx/wupdlock.h>
#include <symbol_lib_table.h>
@ -204,11 +203,15 @@ COMPONENT_TREE::STATE COMPONENT_TREE::getState() const
void COMPONENT_TREE::setState( const STATE& aState )
{
wxWindowUpdateLocker updateLock( m_tree_ctrl );
m_tree_ctrl->Freeze();
for( const auto& item : aState.expanded )
m_tree_ctrl->Expand( item );
// wxDataViewCtrl cannot be frozen when a selection
// command is issued, otherwise it selects a random item (Windows)
m_tree_ctrl->Thaw();
if( aState.selection.IsValid() )
SelectLibId( aState.selection );
}