From 96baaeada6d8341688cae302b5efe0eed1b58b4a Mon Sep 17 00:00:00 2001 From: yossizap Date: Fri, 20 Dec 2019 12:20:27 +0000 Subject: [PATCH] Prevent the update of some widgets while debug task is in progress to avoid freezing --- src/widgets/BacktraceWidget.cpp | 3 ++- src/widgets/ProcessesWidget.cpp | 8 ++++---- src/widgets/SectionsWidget.cpp | 2 +- src/widgets/StackWidget.cpp | 2 +- src/widgets/ThreadsWidget.cpp | 8 ++++---- src/widgets/VisualNavbar.cpp | 6 ++++++ 6 files changed, 18 insertions(+), 11 deletions(-) diff --git a/src/widgets/BacktraceWidget.cpp b/src/widgets/BacktraceWidget.cpp index c2466174..09469099 100644 --- a/src/widgets/BacktraceWidget.cpp +++ b/src/widgets/BacktraceWidget.cpp @@ -38,9 +38,10 @@ BacktraceWidget::~BacktraceWidget() {} void BacktraceWidget::updateContents() { - if (!refreshDeferrer->attemptRefresh(nullptr)) { + if (!refreshDeferrer->attemptRefresh(nullptr) || Core()->isDebugTaskInProgress()) { return; } + setBacktraceGrid(); } diff --git a/src/widgets/ProcessesWidget.cpp b/src/widgets/ProcessesWidget.cpp index f5f10863..e71c9466 100644 --- a/src/widgets/ProcessesWidget.cpp +++ b/src/widgets/ProcessesWidget.cpp @@ -72,16 +72,16 @@ void ProcessesWidget::updateContents() return; } - if (Core()->currentlyDebugging) { - setProcessesGrid(); - } else { + if (!Core()->currentlyDebugging) { // Remove rows from the previous debugging session modelProcesses->removeRows(0, modelProcesses->rowCount()); + return; } - if (Core()->isDebugTaskInProgress() || !Core()->currentlyDebugging) { + if (Core()->isDebugTaskInProgress()) { ui->viewProcesses->setDisabled(true); } else { + setProcessesGrid(); ui->viewProcesses->setDisabled(false); } } diff --git a/src/widgets/SectionsWidget.cpp b/src/widgets/SectionsWidget.cpp index 3ba8829e..8c8a624f 100644 --- a/src/widgets/SectionsWidget.cpp +++ b/src/widgets/SectionsWidget.cpp @@ -237,7 +237,7 @@ void SectionsWidget::initConnects() void SectionsWidget::refreshSections() { - if (!sectionsRefreshDeferrer->attemptRefresh(nullptr)) { + if (!sectionsRefreshDeferrer->attemptRefresh(nullptr) || Core()->isDebugTaskInProgress()) { return; } sectionsModel->beginResetModel(); diff --git a/src/widgets/StackWidget.cpp b/src/widgets/StackWidget.cpp index 772c060e..d4a09f17 100644 --- a/src/widgets/StackWidget.cpp +++ b/src/widgets/StackWidget.cpp @@ -58,7 +58,7 @@ StackWidget::~StackWidget() = default; void StackWidget::updateContents() { - if (!refreshDeferrer->attemptRefresh(nullptr)) { + if (!refreshDeferrer->attemptRefresh(nullptr) || Core()->isDebugTaskInProgress()) { return; } diff --git a/src/widgets/ThreadsWidget.cpp b/src/widgets/ThreadsWidget.cpp index 5c10b90a..a4b6a261 100644 --- a/src/widgets/ThreadsWidget.cpp +++ b/src/widgets/ThreadsWidget.cpp @@ -71,16 +71,16 @@ void ThreadsWidget::updateContents() return; } - if (Core()->currentlyDebugging) { - setThreadsGrid(); - } else { + if (!Core()->currentlyDebugging) { // Remove rows from the previous debugging session modelThreads->removeRows(0, modelThreads->rowCount()); + return; } - if (Core()->isDebugTaskInProgress() || !Core()->currentlyDebugging) { + if (Core()->isDebugTaskInProgress()) { ui->viewThreads->setDisabled(true); } else { + setThreadsGrid(); ui->viewThreads->setDisabled(false); } } diff --git a/src/widgets/VisualNavbar.cpp b/src/widgets/VisualNavbar.cpp index 734aac23..c5b7b430 100644 --- a/src/widgets/VisualNavbar.cpp +++ b/src/widgets/VisualNavbar.cpp @@ -291,6 +291,12 @@ QList VisualNavbar::sectionsForAddress(RVA address) QString VisualNavbar::toolTipForAddress(RVA address) { QString ret = "Address: " + RAddressString(address); + + // Don't append sections when a debug task is in progress to avoid freezing the interface + if (Core()->isDebugTaskInProgress()) { + return ret; + } + auto sections = sectionsForAddress(address); if (sections.count()) { ret += "\nSections: \n";