From 68059e9dfd2dbd3aedaf5ee3bda49abe85a9b4d0 Mon Sep 17 00:00:00 2001 From: Nav Date: Sun, 7 May 2023 03:14:37 +0100 Subject: [PATCH] Refresh hex viewer when opening previous opened snapshot diff window --- .../SnapshotManager/SnapshotManager.cpp | 47 ++++++++++++------- 1 file changed, 30 insertions(+), 17 deletions(-) diff --git a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/SnapshotManager/SnapshotManager.cpp b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/SnapshotManager/SnapshotManager.cpp index 2ea7b457..f24477e3 100644 --- a/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/SnapshotManager/SnapshotManager.cpp +++ b/src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/SnapshotManager/SnapshotManager.cpp @@ -381,27 +381,40 @@ namespace Bloom::Widgets auto snapshotDiffIt = this->snapshotCurrentDiffsBySnapshotAId.find(snapshotIdA); - if (snapshotDiffIt == this->snapshotCurrentDiffsBySnapshotAId.end()) { - const auto& snapshotItA = this->snapshotsById.find(snapshotIdA); + if (snapshotDiffIt != this->snapshotCurrentDiffsBySnapshotAId.end()) { + auto* snapshotDiff = snapshotDiffIt.value(); - if (snapshotItA == this->snapshotsById.end()) { - return; - } - - snapshotDiffIt = this->snapshotCurrentDiffsBySnapshotAId.insert( - snapshotIdA, - new SnapshotDiff( - snapshotItA.value(), - *(this->data), - this->focusedMemoryRegions, - this->excludedMemoryRegions, - this->stackPointer.value_or(0), - this->memoryDescriptor, - this - ) + snapshotDiff->refreshB( + *(this->data), + this->focusedMemoryRegions, + this->excludedMemoryRegions, + this->stackPointer.value_or(0) ); + + snapshotDiff->show(); + snapshotDiff->activateWindow(); + return; } + const auto& snapshotItA = this->snapshotsById.find(snapshotIdA); + + if (snapshotItA == this->snapshotsById.end()) { + return; + } + + snapshotDiffIt = this->snapshotCurrentDiffsBySnapshotAId.insert( + snapshotIdA, + new SnapshotDiff( + snapshotItA.value(), + *(this->data), + this->focusedMemoryRegions, + this->excludedMemoryRegions, + this->stackPointer.value_or(0), + this->memoryDescriptor, + this + ) + ); + auto* snapshotDiff = snapshotDiffIt.value(); snapshotDiff->show(); snapshotDiff->activateWindow();