Skip to content

Commit bf36dd4

Browse files
committed
Easy Setup: Fix crash while displaying Hamlib error.
1 parent 5414585 commit bf36dd4

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/gui/dialogs/dlg_easy_setup.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -857,8 +857,8 @@ void EasySetupDialog::OnTest(wxCommandEvent&)
857857
auto pttType = (HamlibRigController::PttType)m_cbPttMethod->GetSelection();
858858

859859
hamlibTestObject_ = std::make_shared<HamlibRigController>(rig, (const char*)serialPort.ToUTF8(), rate, civHexAddress, pttType);
860-
hamlibTestObject_->onRigError += [&](IRigController*, std::string error) {
861-
CallAfter([&]() {
860+
hamlibTestObject_->onRigError += [this](IRigController*, std::string error) {
861+
CallAfter([this, error]() {
862862
wxMessageBox(
863863
wxString::Format("Couldn't connect to Radio with Hamlib (%s). Make sure the Hamlib serial Device, Rate, and Params match your radio", error),
864864
wxT("Error"), wxOK | wxICON_ERROR, this);
@@ -877,7 +877,7 @@ void EasySetupDialog::OnTest(wxCommandEvent&)
877877

878878
if (!wxGetApp().CanAccessSerialPort((const char*)serialPort.ToUTF8()))
879879
{
880-
CallAfter([&]() {
880+
CallAfter([this]() {
881881
wxMessageBox(
882882
"Couldn't connect to Radio. Make sure the serial Device and Params match your radio",
883883
wxT("Error"), wxOK | wxICON_ERROR, this);
@@ -897,8 +897,8 @@ void EasySetupDialog::OnTest(wxCommandEvent&)
897897
useDTR,
898898
DTRPos
899899
);
900-
serialPortTestObject_->onRigError += [&](IRigController*, std::string error) {
901-
CallAfter([&]() {
900+
serialPortTestObject_->onRigError += [this](IRigController*, std::string error) {
901+
CallAfter([this, error]() {
902902
wxMessageBox(
903903
wxString::Format("Couldn't connect to Radio (%s). Make sure the serial Device and Params match your radio", error),
904904
wxT("Error"), wxOK | wxICON_ERROR, this);

0 commit comments

Comments
 (0)