GUI: possibly fix hang after factory reset

issue #2576
This commit is contained in:
tildearrow 2025-06-18 03:01:04 -05:00
parent a36d78305a
commit b7e63d2ee8
3 changed files with 12 additions and 9 deletions

View file

@ -193,6 +193,4 @@ void DivEngine::factoryReset() {
if (i>0) path+=fmt::sprintf(".%d",i); if (i>0) path+=fmt::sprintf(".%d",i);
deleteFile(path.c_str()); deleteFile(path.c_str());
} }
exit(0);
} }

View file

@ -6573,6 +6573,7 @@ bool FurnaceGUI::loop() {
if (ImGui::Button(_("Yes"))) { if (ImGui::Button(_("Yes"))) {
e->factoryReset(); e->factoryReset();
quit=true; quit=true;
quitNoSave=true;
ImGui::CloseCurrentPopup(); ImGui::CloseCurrentPopup();
} }
popDestColor(); popDestColor();
@ -8378,13 +8379,15 @@ void FurnaceGUI::commitState(DivConfig& conf) {
} }
bool FurnaceGUI::finish(bool saveConfig) { bool FurnaceGUI::finish(bool saveConfig) {
commitState(e->getConfObject()); if (!quitNoSave) {
if (userPresetsOpen) { commitState(e->getConfObject());
saveUserPresets(true); if (userPresetsOpen) {
} saveUserPresets(true);
if (saveConfig) { }
logI("saving config."); if (saveConfig) {
e->saveConf(); logI("saving config.");
e->saveConf();
}
} }
rend->quitGUI(); rend->quitGUI();
ImGui_ImplSDL2_Shutdown(); ImGui_ImplSDL2_Shutdown();
@ -8484,6 +8487,7 @@ FurnaceGUI::FurnaceGUI():
replacePendingSample(false), replacePendingSample(false),
displayExportingROM(false), displayExportingROM(false),
displayExportingCS(false), displayExportingCS(false),
quitNoSave(false),
changeCoarse(false), changeCoarse(false),
mobileEdit(false), mobileEdit(false),
killGraphics(false), killGraphics(false),

View file

@ -1677,6 +1677,7 @@ class FurnaceGUI {
bool displayPendingIns, pendingInsSingle, displayPendingRawSample, snesFilterHex, modTableHex, displayEditString; bool displayPendingIns, pendingInsSingle, displayPendingRawSample, snesFilterHex, modTableHex, displayEditString;
bool displayPendingSamples, replacePendingSample; bool displayPendingSamples, replacePendingSample;
bool displayExportingROM, displayExportingCS; bool displayExportingROM, displayExportingCS;
bool quitNoSave;
bool changeCoarse; bool changeCoarse;
bool mobileEdit; bool mobileEdit;
bool killGraphics; bool killGraphics;