From 089b1470339b43635d8f58f7cb4a84ebb4251110 Mon Sep 17 00:00:00 2001 From: Xusheng Date: Thu, 7 Sep 2023 16:21:25 +0800 Subject: [PATCH] Fix leaking debugger binary view after using the debugger --- ui/ui.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/ui/ui.cpp b/ui/ui.cpp index 98d38fd..3adad95 100644 --- a/ui/ui.cpp +++ b/ui/ui.cpp @@ -1095,14 +1095,15 @@ void DebuggerUI::updateUI(const DebuggerEvent& event) } FileContext* fileContext = frame->getFileContext(); - fileContext->refreshDataViewCache(); + auto tab = m_context->getTabForFile(fileContext); ViewFrame* newFrame = m_context->openFileContext(fileContext); QCoreApplication::processEvents(); if (newFrame) { newFrame->navigate(m_controller->GetData(), m_controller->GetData()->GetEntryPoint(), true, true); - m_context->closeTab(m_context->getTabForFile(fileContext)); + m_context->closeTab(tab); + fileContext->refreshDataViewCache(); openDebuggerSideBar(newFrame); QCoreApplication::processEvents(); } @@ -1139,11 +1140,12 @@ void DebuggerUI::updateUI(const DebuggerEvent& event) ViewFrame* frame = m_context->getCurrentViewFrame(); FileContext* fileContext = frame->getFileContext(); fileContext->refreshDataViewCache(); + auto tab = m_context->getTabForFile(fileContext); ViewFrame* newFrame = m_context->openFileContext(fileContext); if (newFrame) { - m_context->closeTab(m_context->getTabForFile(fileContext)); + m_context->closeTab(tab); navigateToCurrentIP(); QCoreApplication::processEvents(); }