mirror of https://github.com/mgba-emu/mgba.git
Qt: Fix use-after-free in shader settings
This commit is contained in:
parent
7607a5bea9
commit
17cafab7b8
|
@ -437,9 +437,9 @@ void SettingsView::setShaderSelector(ShaderSelector* shaderSelector) {
|
|||
QObject::disconnect(m_shader, nullptr, this, nullptr);
|
||||
}
|
||||
m_shader = shaderSelector;
|
||||
QObject::connect(this, &SettingsView::saveSettingsRequested, m_shader, &ShaderSelector::saveSettings);
|
||||
QObject::connect(m_ui.buttonBox, &QDialogButtonBox::rejected, m_shader, &ShaderSelector::revert);
|
||||
if (shaderSelector) {
|
||||
QObject::connect(this, &SettingsView::saveSettingsRequested, m_shader, &ShaderSelector::saveSettings);
|
||||
QObject::connect(m_ui.buttonBox, &QDialogButtonBox::rejected, m_shader, &ShaderSelector::revert);
|
||||
addPage(tr("Shaders"), m_shader, Page::SHADERS);
|
||||
} else {
|
||||
addPage(tr("Shaders"), m_dummyShader, Page::SHADERS);
|
||||
|
|
|
@ -7,10 +7,12 @@
|
|||
|
||||
#include <QDialog>
|
||||
#include <QMap>
|
||||
#include <QPointer>
|
||||
#include <QTimer>
|
||||
|
||||
#include "ColorPicker.h"
|
||||
#include "LogConfigModel.h"
|
||||
#include "ShaderSelector.h"
|
||||
|
||||
#include <mgba/core/core.h>
|
||||
|
||||
|
@ -25,7 +27,6 @@ namespace QGBA {
|
|||
class ConfigController;
|
||||
class InputController;
|
||||
class ShortcutController;
|
||||
class ShaderSelector;
|
||||
|
||||
class SettingsView : public QDialog {
|
||||
Q_OBJECT
|
||||
|
@ -80,7 +81,7 @@ private:
|
|||
|
||||
ConfigController* m_controller;
|
||||
InputController* m_input;
|
||||
ShaderSelector* m_shader = nullptr;
|
||||
QPointer<ShaderSelector> m_shader;
|
||||
QLabel* m_dummyShader;
|
||||
LogConfigModel m_logModel;
|
||||
QTimer m_checkTimer;
|
||||
|
|
Loading…
Reference in New Issue