From 05bd15a928a6e9d81653812829d569789ee72718 Mon Sep 17 00:00:00 2001 From: Pokechu22 Date: Fri, 19 Feb 2021 20:03:31 -0800 Subject: [PATCH] Clear m_object_data_offsets first and require it before UpdateDescription It still tries to update the description on clearing, potentially with bad data. --- Source/Core/DolphinQt/FIFO/FIFOAnalyzer.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Source/Core/DolphinQt/FIFO/FIFOAnalyzer.cpp b/Source/Core/DolphinQt/FIFO/FIFOAnalyzer.cpp index 7cf804f899..baff4512b8 100644 --- a/Source/Core/DolphinQt/FIFO/FIFOAnalyzer.cpp +++ b/Source/Core/DolphinQt/FIFO/FIFOAnalyzer.cpp @@ -161,8 +161,12 @@ void FIFOAnalyzer::UpdateTree() void FIFOAnalyzer::UpdateDetails() { - m_detail_list->clear(); + // Clearing the detail list can update the selection, which causes UpdateDescription to be called + // immediately. However, the object data offsets have not been recalculated yet, which can cause + // the wrong data to be used, potentially leading to out of bounds data or other bad things. + // Clear m_object_data_offsets first, so that UpdateDescription exits immediately. m_object_data_offsets.clear(); + m_detail_list->clear(); if (!FifoPlayer::GetInstance().IsPlaying()) return; @@ -472,7 +476,7 @@ void FIFOAnalyzer::UpdateDescription() auto items = m_tree_widget->selectedItems(); - if (items.isEmpty()) + if (items.isEmpty() || m_object_data_offsets.empty()) return; int frame_nr = items[0]->data(0, FRAME_ROLE).toInt();