mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-06 01:50:38 +00:00
GUIInvoke takes a QObject* to avoid callbacks after object lifetime
* The GUIInvoke object takes a QObject, and uses QPointer to check that it hasn't been deleted when the callback fires. This prevents delayed callbacks from executing after the object has been deleted and crashing. * In most cases the pointer is just 'this'.
This commit is contained in:
@@ -241,14 +241,14 @@ PerformanceCounterSelection::PerformanceCounterSelection(ICaptureContext &ctx,
|
||||
|
||||
ui->counterTree->setMouseTracking(true);
|
||||
|
||||
ctx.Replay().AsyncInvoke([this, selectedCounters](IReplayController *controller) -> void {
|
||||
ctx.Replay().AsyncInvoke([this, selectedCounters](IReplayController *controller) {
|
||||
QVector<CounterDescription> counterDescriptions;
|
||||
for(const GPUCounter counter : controller->EnumerateCounters())
|
||||
{
|
||||
counterDescriptions.append(controller->DescribeCounter(counter));
|
||||
}
|
||||
|
||||
GUIInvoke::call([counterDescriptions, selectedCounters, this]() -> void {
|
||||
GUIInvoke::call(this, [counterDescriptions, selectedCounters, this]() {
|
||||
SetCounters(counterDescriptions);
|
||||
SetSelectedCounters(selectedCounters);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user