Skip to content

Commit

Permalink
Capture parentTile value, fix crash on macOS (#292)
Browse files Browse the repository at this point in the history
  • Loading branch information
jankae committed Feb 26, 2025
1 parent b6f26eb commit b9523b4
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions Software/PC_Application/LibreVNA-GUI/Traces/traceplot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -417,8 +417,11 @@ void TracePlot::finishContextMenu()
contextmenu->addAction(removeTile);
connect(removeTile, &QAction::triggered, [=]() {
markedForDeletion = true;
QTimer::singleShot(0, [=](){
parentTile->closeTile();
// 'this' object will be deleted when returning function but the following lambda
// might be executed after that and we still need to know which tile to close.
// Capture parentTile explicitly by value
QTimer::singleShot(0, [p=this->parentTile](){
p->closeTile();
});
});

Expand Down

0 comments on commit b9523b4

Please sign in to comment.