mirror of
https://github.com/libretro/mgba.git
synced 2024-12-03 13:50:44 +00:00
Qt: Fix leak if loading a save file fails
This commit is contained in:
parent
52ef584424
commit
c0507b8a71
@ -808,10 +808,14 @@ void CoreController::loadSave(const QString& path, bool temporary) {
|
||||
return;
|
||||
}
|
||||
|
||||
bool ok;
|
||||
if (temporary) {
|
||||
m_threadContext.core->loadTemporarySave(m_threadContext.core, vf);
|
||||
ok = m_threadContext.core->loadTemporarySave(m_threadContext.core, vf);
|
||||
} else {
|
||||
m_threadContext.core->loadSave(m_threadContext.core, vf);
|
||||
ok = m_threadContext.core->loadSave(m_threadContext.core, vf);
|
||||
}
|
||||
if (!ok) {
|
||||
vf->close(vf);
|
||||
}
|
||||
});
|
||||
if (hasStarted()) {
|
||||
@ -821,10 +825,14 @@ void CoreController::loadSave(const QString& path, bool temporary) {
|
||||
|
||||
void CoreController::loadSave(VFile* vf, bool temporary) {
|
||||
m_resetActions.append([this, vf, temporary]() {
|
||||
bool ok;
|
||||
if (temporary) {
|
||||
m_threadContext.core->loadTemporarySave(m_threadContext.core, vf);
|
||||
ok = m_threadContext.core->loadTemporarySave(m_threadContext.core, vf);
|
||||
} else {
|
||||
m_threadContext.core->loadSave(m_threadContext.core, vf);
|
||||
ok = m_threadContext.core->loadSave(m_threadContext.core, vf);
|
||||
}
|
||||
if (!ok) {
|
||||
vf->close(vf);
|
||||
}
|
||||
});
|
||||
if (hasStarted()) {
|
||||
|
Loading…
Reference in New Issue
Block a user