Corrected segmentation fault bug caused by QHash iterator invalidation
This commit is contained in:
@@ -174,10 +174,10 @@ namespace Bloom::Widgets
|
||||
}
|
||||
|
||||
void SnapshotManager::addSnapshot(MemorySnapshot&& snapshotTmp) {
|
||||
const auto snapshotIt = this->snapshotsById.emplace(snapshotTmp.id, std::move(snapshotTmp));
|
||||
const auto snapshotIt = this->snapshotsById.insert(snapshotTmp.id, std::move(snapshotTmp));
|
||||
const auto& snapshot = *snapshotIt;
|
||||
|
||||
const auto snapshotItemIt = this->snapshotItemsById.emplace(snapshot.id, new MemorySnapshotItem(snapshot));
|
||||
const auto snapshotItemIt = this->snapshotItemsById.insert(snapshot.id, new MemorySnapshotItem(snapshot));
|
||||
auto& snapshotItem = *snapshotItemIt;
|
||||
|
||||
this->snapshotListScene->addListItem(snapshotItem);
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#include <QResizeEvent>
|
||||
#include <QShowEvent>
|
||||
#include <QVBoxLayout>
|
||||
#include <QHash>
|
||||
#include <QMap>
|
||||
|
||||
#include "src/Insight/UserInterfaces/InsightWindow/Widgets/PaneWidget.hpp"
|
||||
#include "src/Insight/UserInterfaces/InsightWindow/Widgets/SvgToolButton.hpp"
|
||||
@@ -56,8 +56,8 @@ namespace Bloom::Widgets
|
||||
const std::vector<FocusedMemoryRegion>& focusedMemoryRegions;
|
||||
const std::vector<ExcludedMemoryRegion>& excludedMemoryRegions;
|
||||
|
||||
QHash<QString, MemorySnapshot> snapshotsById;
|
||||
QHash<QString, MemorySnapshotItem*> snapshotItemsById;
|
||||
QMap<QString, MemorySnapshot> snapshotsById;
|
||||
QMap<QString, MemorySnapshotItem*> snapshotItemsById;
|
||||
|
||||
QWidget* container = nullptr;
|
||||
QWidget* toolBar = nullptr;
|
||||
|
||||
Reference in New Issue
Block a user