Fix Choose Symbol dialog freezes in eeschema

Scrollbars are always enabled to prevent an infinite event loop caused
by alternating CreateLayout() and OnSize event handler.
More details: http://trac.wxwidgets.org/ticket/18141

Fixes: lp:1767848
* https://bugs.launchpad.net/kicad/+bug/1767848
This commit is contained in:
Maciej Suminski 2018-06-06 08:47:53 +02:00
parent 9552e02727
commit 51c7381fd5
1 changed files with 8 additions and 0 deletions

View File

@ -85,6 +85,7 @@ COMPONENT_TREE::COMPONENT_TREE( wxWindow* aParent, SYMBOL_LIB_TABLE* aSymLibTabl
if( !aDetails ) if( !aDetails )
{ {
auto html_sz = ConvertDialogToPixels( wxPoint( 80, 80 ) ); auto html_sz = ConvertDialogToPixels( wxPoint( 80, 80 ) );
m_details_ctrl = new wxHtmlWindow( m_details_ctrl = new wxHtmlWindow(
this, wxID_ANY, wxDefaultPosition, wxSize( html_sz.x, html_sz.y ), this, wxID_ANY, wxDefaultPosition, wxSize( html_sz.x, html_sz.y ),
wxHW_SCROLLBAR_AUTO ); wxHW_SCROLLBAR_AUTO );
@ -95,6 +96,7 @@ COMPONENT_TREE::COMPONENT_TREE( wxWindow* aParent, SYMBOL_LIB_TABLE* aSymLibTabl
{ {
m_details_ctrl = aDetails; m_details_ctrl = aDetails;
} }
m_details_ctrl->Bind( wxEVT_HTML_LINK_CLICKED, &COMPONENT_TREE::onDetailsLink, this ); m_details_ctrl->Bind( wxEVT_HTML_LINK_CLICKED, &COMPONENT_TREE::onDetailsLink, this );
} }
@ -120,6 +122,12 @@ COMPONENT_TREE::COMPONENT_TREE( wxWindow* aParent, SYMBOL_LIB_TABLE* aSymLibTabl
Layout(); Layout();
sizer->Fit( this ); sizer->Fit( this );
#ifdef __WXGTK__
// Scrollbars must be always enabled to prevent an infinite event loop
// more details: http://trac.wxwidgets.org/ticket/18141
m_details_ctrl->ShowScrollbars( wxSHOW_SB_ALWAYS, wxSHOW_SB_ALWAYS );
#endif /* __WXGTK__ */
} }