From 7cc014cf9ead2367a7e9270012329b2bcbb208c9 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Thu, 4 May 2023 11:29:13 +0100 Subject: [PATCH] Be careful of infobar outliving symbol. Fixes https://gitlab.com/kicad/code/kicad/issues/14680 --- eeschema/symbol_editor/symbol_edit_frame.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/eeschema/symbol_editor/symbol_edit_frame.cpp b/eeschema/symbol_editor/symbol_edit_frame.cpp index 95924598d9..8e82bf13d2 100644 --- a/eeschema/symbol_editor/symbol_edit_frame.cpp +++ b/eeschema/symbol_editor/symbol_edit_frame.cpp @@ -781,7 +781,7 @@ void SYMBOL_EDIT_FRAME::SetCurSymbol( LIB_SYMBOL* aSymbol, bool aUpdateZoom ) wxEmptyString ); button->Bind( wxEVT_COMMAND_HYPERLINK, std::function( - [&]( wxHyperlinkEvent& aEvent ) + [=]( wxHyperlinkEvent& aEvent ) { InvokeSchEditSymbolLibTable( &Kiway(), this ); } ) ); @@ -795,6 +795,8 @@ void SYMBOL_EDIT_FRAME::SetCurSymbol( LIB_SYMBOL* aSymbol, bool aUpdateZoom ) else if( IsSymbolAlias() ) { wxString parentSymbolName = m_symbol->GetParent().lock()->GetName(); + int unit = GetUnit(); + int convert = GetConvert(); wxString msg; wxString link; @@ -806,10 +808,9 @@ void SYMBOL_EDIT_FRAME::SetCurSymbol( LIB_SYMBOL* aSymbol, bool aUpdateZoom ) wxHyperlinkCtrl* button = new wxHyperlinkCtrl( infobar, wxID_ANY, link, wxEmptyString ); button->Bind( wxEVT_COMMAND_HYPERLINK, std::function( - [&]( wxHyperlinkEvent& aEvent ) + [=]( wxHyperlinkEvent& aEvent ) { - LoadSymbolFromCurrentLib( m_symbol->GetParent().lock()->GetName(), - GetUnit(), GetConvert() ); + LoadSymbolFromCurrentLib( parentSymbolName, unit, convert ); } ) ); infobar->RemoveAllButtons();