Capture parentTile value, fix crash on macOS (#292)

This commit is contained in:
Jan Käberich 2025-02-26 10:16:55 +01:00
parent b6f26eb6dc
commit b9523b4864

View file

@ -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();
});
});