Coverity fixes: lambda parameters by reference

For BUTTON_ROW_PANEL::BTN_DEF_LIST, the  button definition does not need to be
passed by value, by non-const reference avoids copies and this addresses the
Coverity warnings: 184130, 184134, 184140, 184167.

Also use a unique_ptr to clarify ownership sementics when handing widget
over to WX.
This commit is contained in:
John Beard 2019-02-25 13:31:58 +00:00
parent 4bf52b9266
commit 787e410a55
1 changed files with 6 additions and 6 deletions

View File

@ -105,7 +105,7 @@ void PANEL_HOTKEYS_EDITOR::installButtons( wxSizer* aSizer )
wxID_RESET,
_( "Reset Hotkeys" ),
_( "Undo all changes made so far in this dialog" ),
[this]( wxCommandEvent ){
[this]( wxCommandEvent& ){
m_hotkeyListCtrl->ResetAllHotkeys( false );
}
},
@ -113,7 +113,7 @@ void PANEL_HOTKEYS_EDITOR::installButtons( wxSizer* aSizer )
wxID_ANY,
_( "Set to Defaults" ),
_( "Set all hotkeys to the built-in KiCad defaults" ),
[this]( wxCommandEvent ){
[this]( wxCommandEvent& ){
m_hotkeyListCtrl->ResetAllHotkeys( true );
}
}
@ -124,7 +124,7 @@ void PANEL_HOTKEYS_EDITOR::installButtons( wxSizer* aSizer )
wxID_ANY,
_( "Import..." ),
_( "Import hotkey definitions from an external file, replacing the current values" ),
[this]( wxCommandEvent ){
[this]( wxCommandEvent& ){
m_frame->ImportHotkeyConfigFromFile( m_hotkeys, m_nickname );
}
},
@ -132,15 +132,15 @@ void PANEL_HOTKEYS_EDITOR::installButtons( wxSizer* aSizer )
wxID_ANY,
_( "Export..." ),
_( "Export these hotkey definitions to an external file" ),
[this]( wxCommandEvent ){
[this]( wxCommandEvent& ){
m_frame->ExportHotkeyConfigToFile( m_hotkeys, m_nickname );
}
},
};
auto btnPanel = new BUTTON_ROW_PANEL( this, l_btn_defs, r_btn_defs );
auto btnPanel = std::make_unique<BUTTON_ROW_PANEL>( this, l_btn_defs, r_btn_defs );
aSizer->Add( btnPanel, 0, wxEXPAND | wxTOP, KIUI::GetStdMargin() );
aSizer->Add( btnPanel.release(), 0, wxEXPAND | wxTOP, KIUI::GetStdMargin() );
}