diff --git a/Source/GUI/MemViewer/MemViewer.cpp b/Source/GUI/MemViewer/MemViewer.cpp index 16e836ad..8b661ad3 100644 --- a/Source/GUI/MemViewer/MemViewer.cpp +++ b/Source/GUI/MemViewer/MemViewer.cpp @@ -497,9 +497,11 @@ void MemViewer::addByteIndexAsWatch(int index) { MemWatchEntry* entry = new MemWatchEntry(); entry->setConsoleAddress(m_currentFirstAddress + index); - DlgAddWatchEntry* dlg = new DlgAddWatchEntry(true, entry, this); - if (dlg->exec() == QDialog::Accepted) - emit addWatch(dlg->stealEntry()); + DlgAddWatchEntry dlg(true, entry, this); + if (dlg.exec() == QDialog::Accepted) + { + emit addWatch(dlg.stealEntry()); + } } bool MemViewer::handleNaviguationKey(const int key, bool shiftIsHeld) diff --git a/Source/GUI/MemWatcher/MemWatchWidget.cpp b/Source/GUI/MemWatcher/MemWatchWidget.cpp index 7a071d18..9c7d2afa 100644 --- a/Source/GUI/MemWatcher/MemWatchWidget.cpp +++ b/Source/GUI/MemWatcher/MemWatchWidget.cpp @@ -381,10 +381,10 @@ void MemWatchWidget::onWatchDoubleClicked(const QModelIndex& index) else if (index.column() == MemWatchModel::WATCH_COL_ADDRESS && !node->isGroup()) { MemWatchEntry* entryCopy = new MemWatchEntry(node->getEntry()); - DlgAddWatchEntry* dlg = new DlgAddWatchEntry(false, entryCopy, this); - if (dlg->exec() == QDialog::Accepted) + DlgAddWatchEntry dlg(false, entryCopy, this); + if (dlg.exec() == QDialog::Accepted) { - m_watchModel->editEntry(entryCopy, index); + m_watchModel->editEntry(dlg.stealEntry(), index); m_hasUnsavedChanges = true; } } @@ -499,9 +499,11 @@ void MemWatchWidget::onAddGroup() void MemWatchWidget::onAddWatchEntry() { - DlgAddWatchEntry* dlg = new DlgAddWatchEntry(true, nullptr, this); - if (dlg->exec() == QDialog::Accepted) - addWatchEntry(dlg->stealEntry()); + DlgAddWatchEntry dlg(true, nullptr, this); + if (dlg.exec() == QDialog::Accepted) + { + addWatchEntry(dlg.stealEntry()); + } } void MemWatchWidget::addWatchEntry(MemWatchEntry* entry)