mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 14:19:46 -06:00
Fix bad memory references in NewPatchDialog
This code was storing references to patch entries which could move around in memory if a patch was erased from the middle of a vector or if the vector itself was reallocated. Instead, NewPatchDialog maintains a separate copy of the patch entries which are committed back to the patch if the user accepts the changes.
This commit is contained in:
@ -4,6 +4,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include <QDialog>
|
||||
@ -21,10 +22,13 @@ class QLineEdit;
|
||||
class QVBoxLayout;
|
||||
class QPushButton;
|
||||
|
||||
struct NewPatchEntry;
|
||||
|
||||
class NewPatchDialog : public QDialog
|
||||
{
|
||||
public:
|
||||
explicit NewPatchDialog(QWidget* parent, PatchEngine::Patch& patch);
|
||||
~NewPatchDialog() override;
|
||||
|
||||
private:
|
||||
void CreateWidgets();
|
||||
@ -33,7 +37,7 @@ private:
|
||||
|
||||
void accept() override;
|
||||
|
||||
QGroupBox* CreateEntry(PatchEngine::PatchEntry& entry);
|
||||
QGroupBox* CreateEntry(const PatchEngine::PatchEntry& entry);
|
||||
|
||||
QLineEdit* m_name_edit;
|
||||
QWidget* m_entry_widget;
|
||||
@ -41,7 +45,7 @@ private:
|
||||
QPushButton* m_add_button;
|
||||
QDialogButtonBox* m_button_box;
|
||||
|
||||
std::vector<QLineEdit*> m_edits;
|
||||
std::vector<std::unique_ptr<NewPatchEntry>> m_entries;
|
||||
|
||||
PatchEngine::Patch& m_patch;
|
||||
};
|
||||
|
Reference in New Issue
Block a user