diff --git a/qrenderdoc/Windows/Dialogs/PerformanceCounterSelection.cpp b/qrenderdoc/Windows/Dialogs/PerformanceCounterSelection.cpp index dcb018cb6..1def5fb07 100644 --- a/qrenderdoc/Windows/Dialogs/PerformanceCounterSelection.cpp +++ b/qrenderdoc/Windows/Dialogs/PerformanceCounterSelection.cpp @@ -253,17 +253,21 @@ PerformanceCounterSelection::PerformanceCounterSelection(ICaptureContext &ctx, ui->counterTree->setMouseTracking(true); - ctx.Replay().AsyncInvoke([this, selectedCounters](IReplayController *controller) { + QPointer ptr(this); + ctx.Replay().AsyncInvoke([this, ptr, selectedCounters](IReplayController *controller) { QVector counterDescriptions; for(const GPUCounter counter : controller->EnumerateCounters()) { counterDescriptions.append(controller->DescribeCounter(counter)); } - GUIInvoke::call(this, [counterDescriptions, selectedCounters, this]() { - SetCounters(counterDescriptions); - SetSelectedCounters(selectedCounters); - }); + if(ptr) + { + GUIInvoke::call(this, [counterDescriptions, selectedCounters, this]() { + SetCounters(counterDescriptions); + SetSelectedCounters(selectedCounters); + }); + } }); }