Browse Source

Don't capture references to local variables for CallAfter.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/16934

(cherry picked from commit 9d40374baf)
newinvert
Jeff Young 2 years ago
committed by Roberto Fernandez Bautista
parent
commit
9ff66d0e71
  1. 2
      common/eda_base_frame.cpp
  2. 2
      common/widgets/properties_panel.cpp
  3. 6
      common/widgets/search_pane_tab.cpp
  4. 2
      common/widgets/widget_hotkey_list.cpp
  5. 2
      cvpcb/display_footprints_frame.cpp
  6. 2
      eeschema/widgets/sch_properties_panel.cpp
  7. 2
      gerbview/gerbview_frame.cpp
  8. 9
      kicad/update_manager.cpp
  9. 2
      pagelayout_editor/pl_editor_frame.cpp
  10. 2
      pcbnew/footprint_edit_frame.cpp
  11. 4
      pcbnew/pcb_edit_frame.cpp
  12. 2
      pcbnew/widgets/appearance_controls.cpp
  13. 2
      pcbnew/widgets/pcb_properties_panel.cpp
  14. 5
      scripting/kipython_frame.cpp

2
common/eda_base_frame.cpp

@ -483,7 +483,7 @@ void EDA_BASE_FRAME::ReCreateMenuBar()
* ensure that they do not occur within the same event handling call stack.
*/
CallAfter( [&]()
CallAfter( [this]()
{
if( !m_isClosing )
doReCreateMenuBar();

2
common/widgets/properties_panel.cpp

@ -133,7 +133,7 @@ PROPERTIES_PANEL::PROPERTIES_PANEL( wxWindow* aParent, EDA_BASE_FRAME* aFrame )
Bind( wxEVT_SIZE,
[&]( wxSizeEvent& aEvent )
{
CallAfter( [&]()
CallAfter( [this]()
{
RecalculateSplitterPos();
} );

6
common/widgets/search_pane_tab.cpp

@ -80,10 +80,12 @@ void SEARCH_PANE_LISTVIEW::GetSelectRowsList( std::vector<long>& aSelectedList )
void SEARCH_PANE_LISTVIEW::OnItemActivated( wxListEvent& aEvent )
{
long item = aEvent.GetIndex();
CallAfter(
[&]()
[this, item]()
{
m_handler->ActivateItem( aEvent.GetIndex() );
m_handler->ActivateItem( item );
} );
m_selectionDirty = true;

2
common/widgets/widget_hotkey_list.cpp

@ -541,7 +541,7 @@ WIDGET_HOTKEY_LIST::WIDGET_HOTKEY_LIST( wxWindow* aParent, HOTKEY_STORE& aHotkey
dv->GetColumn( 2 )->SetMinWidth( aParent->GetTextExtent( longKey ).x + pad );
dv->GetColumn( 3 )->SetMinWidth( aParent->GetTextExtent( command_header ).x * 5 + pad );
CallAfter( [&]()
CallAfter( [this]()
{
GetDataView()->Update();
} );

2
cvpcb/display_footprints_frame.cpp

@ -164,7 +164,7 @@ DISPLAY_FOOTPRINTS_FRAME::DISPLAY_FOOTPRINTS_FRAME( KIWAY* aKiway, wxWindow* aPa
// Register a call to update the toolbar sizes. It can't be done immediately because
// it seems to require some sizes calculated that aren't yet (at least on GTK).
CallAfter( [&]()
CallAfter( [this]()
{
// Ensure the controls on the toolbars all are correctly sized
UpdateToolbarControlSizes();

2
eeschema/widgets/sch_properties_panel.cpp

@ -116,7 +116,7 @@ void SCH_PROPERTIES_PANEL::AfterCommit()
rebuildProperties( selection );
CallAfter( [&]()
CallAfter( [this]()
{
m_frame->GetCanvas()->SetFocus();
} );

2
gerbview/gerbview_frame.cpp

@ -198,7 +198,7 @@ GERBVIEW_FRAME::GERBVIEW_FRAME( KIWAY* aKiway, wxWindow* aParent )
// Register a call to update the toolbar sizes. It can't be done immediately because
// it seems to require some sizes calculated that aren't yet (at least on GTK).
CallAfter( [&]()
CallAfter( [this]()
{
// Ensure the controls on the toolbars all are correctly sized
UpdateToolbarControlSizes();

9
kicad/update_manager.cpp

@ -226,10 +226,11 @@ void UPDATE_MANAGER::CheckForUpdate( wxWindow* aNoticeParent )
if( response.version != settings->m_lastReceivedUpdate )
{
aNoticeParent->CallAfter(
[&]()
[aNoticeParent, response]()
{
auto notice = new DIALOG_UPDATE_NOTICE(
aNoticeParent, response.version, response.details_url,
auto notice = new DIALOG_UPDATE_NOTICE( aNoticeParent,
response.version,
response.details_url,
response.downloads_url );
int retCode = notice->ShowModal();
@ -238,6 +239,8 @@ void UPDATE_MANAGER::CheckForUpdate( wxWindow* aNoticeParent )
{
// basically saving the last received update prevents us from
// prompting again
SETTINGS_MANAGER& mgr = Pgm().GetSettingsManager();
KICAD_SETTINGS* settings = mgr.GetAppSettings<KICAD_SETTINGS>();
settings->m_lastReceivedUpdate = response.version;
}
} );

2
pagelayout_editor/pl_editor_frame.cpp

@ -223,7 +223,7 @@ PL_EDITOR_FRAME::PL_EDITOR_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
// Register a call to update the toolbar sizes. It can't be done immediately because
// it seems to require some sizes calculated that aren't yet (at least on GTK).
CallAfter( [&]()
CallAfter( [this]()
{
// Ensure the controls on the toolbars all are correctly sized
UpdateToolbarControlSizes();

2
pcbnew/footprint_edit_frame.cpp

@ -302,7 +302,7 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
// Register a call to update the toolbar sizes. It can't be done immediately because
// it seems to require some sizes calculated that aren't yet (at least on GTK).
CallAfter(
[&]()
[this]()
{
// Ensure the controls on the toolbars all are correctly sized
UpdateToolbarControlSizes();

4
pcbnew/pcb_edit_frame.cpp

@ -451,7 +451,7 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
#ifdef __WXMAC__
if( Kiface().IsSingle() )
{
CallAfter( [&]()
CallAfter( [this]()
{
m_appearancePanel->OnBoardChanged();
} );
@ -460,7 +460,7 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
// Register a call to update the toolbar sizes. It can't be done immediately because
// it seems to require some sizes calculated that aren't yet (at least on GTK).
CallAfter( [&]()
CallAfter( [this]()
{
// Ensure the controls on the toolbars all are correctly sized
UpdateToolbarControlSizes();

2
pcbnew/widgets/appearance_controls.cpp

@ -994,7 +994,7 @@ void APPEARANCE_CONTROLS::OnNetGridMouseEvent( wxMouseEvent& aEvent )
else if( aEvent.Dragging() )
{
// not allowed
CallAfter( [&]()
CallAfter( [this]()
{
m_netsGrid->ClearSelection();
} );

2
pcbnew/widgets/pcb_properties_panel.cpp

@ -122,7 +122,7 @@ void PCB_PROPERTIES_PANEL::AfterCommit()
rebuildProperties( selection );
CallAfter( [&]()
CallAfter( [this]()
{
static_cast<PCB_EDIT_FRAME*>( m_frame )->GetCanvas()->SetFocus();
} );

5
scripting/kipython_frame.cpp

@ -90,7 +90,10 @@ KIPYTHON_FRAME::KIPYTHON_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE, wxT( "KiPython" ),
unityScale )
{
CallAfter( [&](){ SetupPythonEditor(); } );
CallAfter( [this]()
{
SetupPythonEditor();
} );
redirectStdio();
}

Loading…
Cancel
Save