@@ -884,7 +884,12 @@ private void CheckMayCloseAndCleanup(object/*?*/ closingSender, CancelEventArgs
884884 StopAv ( ) ;
885885 }
886886
887- SaveConfig ( ) ; // TODO: Handle failure.
887+ TryAgainResult configSaveResult = this . DoWithTryAgainBox ( ( ) => SaveConfig ( ) , "Failed to save config file." ) ;
888+ if ( configSaveResult == TryAgainResult . Canceled )
889+ {
890+ closingArgs . Cancel = true ;
891+ return ;
892+ }
888893
889894 if ( ! CloseGame ( ) )
890895 {
@@ -2407,7 +2412,7 @@ public ISettingsAdapter GetSettingsAdapterForLoadedCore<T>()
24072412 public SettingsAdapter GetSettingsAdapterForLoadedCoreUntyped ( )
24082413 => new ( Emulator , static ( ) => true , HandlePutCoreSettings , MayPutCoreSyncSettings , HandlePutCoreSyncSettings ) ;
24092414
2410- private void SaveConfig ( string path = "" )
2415+ private FileWriteResult SaveConfig ( string path = "" )
24112416 {
24122417 if ( Config . SaveWindowPosition )
24132418 {
@@ -2433,7 +2438,7 @@ private void SaveConfig(string path = "")
24332438 }
24342439
24352440 CommitCoreSettingsToConfig ( ) ;
2436- ConfigService . Save ( path , Config ) ;
2441+ return ConfigService . Save ( path , Config ) ;
24372442 }
24382443
24392444 private void ToggleFps ( )
@@ -3928,10 +3933,7 @@ private bool CloseGame(bool clearSram = false)
39283933 }
39293934 // There is a cheats tool, but cheats can be active while the "cheats tool" is not. And have auto-save option.
39303935 TryAgainResult cheatSaveResult = this . DoWithTryAgainBox ( CheatList . SaveOnClose , "Failed to save cheats." ) ;
3931- if ( cheatSaveResult == TryAgainResult . Canceled )
3932- {
3933- return false ;
3934- }
3936+ if ( cheatSaveResult == TryAgainResult . Canceled ) return false ;
39353937
39363938 // If TAStudio is open, we already asked about saving the movie.
39373939 if ( ! Tools . IsLoaded < TAStudio > ( ) )
0 commit comments