mirror of
https://github.com/melonDS-emu/melonDS.git
synced 2024-11-14 05:17:40 -07:00
proof all dialogs against use-after-free when closing main window while a dialog is open
This commit is contained in:
parent
a61754bb58
commit
f2dce621ce
@ -170,6 +170,12 @@ void AudioSettingsDialog::on_AudioSettingsDialog_accepted()
|
||||
|
||||
void AudioSettingsDialog::on_AudioSettingsDialog_rejected()
|
||||
{
|
||||
if (!((MainWindow*)parent())->getEmuInstance())
|
||||
{
|
||||
closeDlg();
|
||||
return;
|
||||
}
|
||||
|
||||
auto& cfg = emuInstance->getGlobalConfig();
|
||||
auto& instcfg = emuInstance->getLocalConfig();
|
||||
cfg.SetInt("Audio.Interpolation", oldInterp);
|
||||
|
@ -163,6 +163,12 @@ void CameraSettingsDialog::on_CameraSettingsDialog_accepted()
|
||||
|
||||
void CameraSettingsDialog::on_CameraSettingsDialog_rejected()
|
||||
{
|
||||
if (!((MainWindow*)parent())->getEmuInstance())
|
||||
{
|
||||
closeDlg();
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
camManager[i]->stop();
|
||||
|
@ -215,6 +215,13 @@ void EmuSettingsDialog::verifyFirmware()
|
||||
|
||||
void EmuSettingsDialog::done(int r)
|
||||
{
|
||||
if (!((MainWindow*)parent())->getEmuInstance())
|
||||
{
|
||||
QDialog::done(r);
|
||||
closeDlg();
|
||||
return;
|
||||
}
|
||||
|
||||
needsReset = false;
|
||||
|
||||
if (r == QDialog::Accepted)
|
||||
|
@ -132,6 +132,13 @@ bool FirmwareSettingsDialog::verifyMAC()
|
||||
|
||||
void FirmwareSettingsDialog::done(int r)
|
||||
{
|
||||
if (!((MainWindow*)parent())->getEmuInstance())
|
||||
{
|
||||
QDialog::done(r);
|
||||
closeDlg();
|
||||
return;
|
||||
}
|
||||
|
||||
needsReset = false;
|
||||
|
||||
if (r == QDialog::Accepted)
|
||||
|
@ -104,6 +104,13 @@ void InterfaceSettingsDialog::on_pbQuarter_clicked()
|
||||
|
||||
void InterfaceSettingsDialog::done(int r)
|
||||
{
|
||||
if (!((MainWindow*)parent())->getEmuInstance())
|
||||
{
|
||||
QDialog::done(r);
|
||||
closeDlg();
|
||||
return;
|
||||
}
|
||||
|
||||
if (r == QDialog::Accepted)
|
||||
{
|
||||
auto& cfg = emuInstance->getGlobalConfig();
|
||||
|
@ -65,6 +65,12 @@ LANStartHostDialog::~LANStartHostDialog()
|
||||
|
||||
void LANStartHostDialog::done(int r)
|
||||
{
|
||||
if (!((MainWindow*)parent())->getEmuInstance())
|
||||
{
|
||||
QDialog::done(r);
|
||||
return;
|
||||
}
|
||||
|
||||
if (r == QDialog::Accepted)
|
||||
{
|
||||
if (ui->txtPlayerName->text().trimmed().isEmpty())
|
||||
@ -186,6 +192,12 @@ void LANStartClientDialog::onDirectConnect()
|
||||
|
||||
void LANStartClientDialog::done(int r)
|
||||
{
|
||||
if (!((MainWindow*)parent())->getEmuInstance())
|
||||
{
|
||||
QDialog::done(r);
|
||||
return;
|
||||
}
|
||||
|
||||
if (r == QDialog::Accepted)
|
||||
{
|
||||
if (ui->txtPlayerName->text().trimmed().isEmpty())
|
||||
@ -313,6 +325,12 @@ void LANDialog::on_btnLeaveGame_clicked()
|
||||
|
||||
void LANDialog::done(int r)
|
||||
{
|
||||
if (!((MainWindow*)parent())->getEmuInstance())
|
||||
{
|
||||
QDialog::done(r);
|
||||
return;
|
||||
}
|
||||
|
||||
bool showwarning = true;
|
||||
if (lan().GetNumPlayers() < 2)
|
||||
showwarning = false;
|
||||
|
@ -59,6 +59,13 @@ MPSettingsDialog::~MPSettingsDialog()
|
||||
|
||||
void MPSettingsDialog::done(int r)
|
||||
{
|
||||
if (!((MainWindow*)parent())->getEmuInstance())
|
||||
{
|
||||
QDialog::done(r);
|
||||
closeDlg();
|
||||
return;
|
||||
}
|
||||
|
||||
if (r == QDialog::Accepted)
|
||||
{
|
||||
auto& cfg = emuInstance->getGlobalConfig();
|
||||
|
@ -63,6 +63,12 @@ NetplayStartHostDialog::~NetplayStartHostDialog()
|
||||
|
||||
void NetplayStartHostDialog::done(int r)
|
||||
{
|
||||
if (!((MainWindow*)parent())->getEmuInstance())
|
||||
{
|
||||
QDialog::done(r);
|
||||
return;
|
||||
}
|
||||
|
||||
if (r == QDialog::Accepted)
|
||||
{
|
||||
std::string player = ui->txtPlayerName->text().toStdString();
|
||||
@ -94,6 +100,12 @@ NetplayStartClientDialog::~NetplayStartClientDialog()
|
||||
|
||||
void NetplayStartClientDialog::done(int r)
|
||||
{
|
||||
if (!((MainWindow*)parent())->getEmuInstance())
|
||||
{
|
||||
QDialog::done(r);
|
||||
return;
|
||||
}
|
||||
|
||||
if (r == QDialog::Accepted)
|
||||
{
|
||||
std::string player = ui->txtPlayerName->text().toStdString();
|
||||
|
@ -72,6 +72,13 @@ PathSettingsDialog::~PathSettingsDialog()
|
||||
|
||||
void PathSettingsDialog::done(int r)
|
||||
{
|
||||
if (!((MainWindow*)parent())->getEmuInstance())
|
||||
{
|
||||
QDialog::done(r);
|
||||
closeDlg();
|
||||
return;
|
||||
}
|
||||
|
||||
needsReset = false;
|
||||
|
||||
if (r == QDialog::Accepted)
|
||||
|
@ -121,6 +121,12 @@ void VideoSettingsDialog::on_VideoSettingsDialog_accepted()
|
||||
|
||||
void VideoSettingsDialog::on_VideoSettingsDialog_rejected()
|
||||
{
|
||||
if (!((MainWindow*)parent())->getEmuInstance())
|
||||
{
|
||||
closeDlg();
|
||||
return;
|
||||
}
|
||||
|
||||
bool old_gl = UsesGL();
|
||||
|
||||
auto& cfg = emuInstance->getGlobalConfig();
|
||||
|
@ -94,6 +94,13 @@ WifiSettingsDialog::~WifiSettingsDialog()
|
||||
|
||||
void WifiSettingsDialog::done(int r)
|
||||
{
|
||||
if (!((MainWindow*)parent())->getEmuInstance())
|
||||
{
|
||||
QDialog::done(r);
|
||||
closeDlg();
|
||||
return;
|
||||
}
|
||||
|
||||
needsReset = false;
|
||||
|
||||
if (r == QDialog::Accepted)
|
||||
|
Loading…
Reference in New Issue
Block a user