Prevent needless refresh tasks being created when opening the memory inspection pane

This commit is contained in:
Nav
2023-04-27 19:14:33 +01:00
parent 0ef83f275b
commit f9e8e27374
2 changed files with 14 additions and 0 deletions

View File

@@ -382,6 +382,17 @@ namespace Bloom::Widgets
}
);
QObject::connect(
readMemoryTask.get(),
&InsightWorkerTask::finished,
this,
[this, taskId = readMemoryTask->id] {
if (this->activeRefreshTask.has_value() && this->activeRefreshTask->get()->id == taskId) {
this->activeRefreshTask.reset();
}
}
);
// If we're refreshing RAM, the UI should only be updated once we've retrieved the current stack pointer.
if (this->targetMemoryDescriptor.type != Targets::TargetMemoryType::RAM) {
QObject::connect(
@@ -421,6 +432,7 @@ namespace Bloom::Widgets
);
}
this->activeRefreshTask = readMemoryTask;
this->taskProgressIndicator->addTask(readMemoryTask);
InsightWorker::queueTask(readMemoryTask);
}

View File

@@ -20,6 +20,7 @@
#include "src/Insight/UserInterfaces/InsightWindow/Widgets/TaskProgressIndicator/TaskProgressIndicator.hpp"
#include "src/Insight/InsightWorker/Tasks/InsightWorkerTask.hpp"
#include "src/Insight/InsightWorker/Tasks/ReadTargetMemory.hpp"
#include "HexViewerWidget/HexViewerWidget.hpp"
#include "MemoryRegionManager/MemoryRegionManagerWindow.hpp"
@@ -58,6 +59,7 @@ namespace Bloom::Widgets
const Targets::TargetMemoryDescriptor& targetMemoryDescriptor;
std::optional<Targets::TargetMemoryBuffer> data;
std::optional<QSharedPointer<ReadTargetMemory>> activeRefreshTask;
QWidget* container = nullptr;
QHBoxLayout* subContainerLayout = nullptr;