[gnome-chess] Fix autosaved game being deleted when window is not closed with Ctrl+Q



commit 6c5c3736f5e782b4c255250d302416e2e2aa029a
Author: Michael Catanzaro <mcatanzaro gnome org>
Date:   Tue Apr 6 13:08:09 2021 -0500

    Fix autosaved game being deleted when window is not closed with Ctrl+Q
    
    We accidentally delete our autosave file when closing the main window
    directly rather than via Ctrl+Q, which activates the Quit action. Let's
    always autosave regardless of how we are shutting down.
    
    This seems to have been a regression from the port to GTK 4, although
    I'm not entirely sure why. Doesn't matter: shutdown is clearly the right
    place for this code.

 src/gnome-chess.vala | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)
---
diff --git a/src/gnome-chess.vala b/src/gnome-chess.vala
index 96b7e4b..a587a79 100644
--- a/src/gnome-chess.vala
+++ b/src/gnome-chess.vala
@@ -203,11 +203,6 @@ Copyright © 2015–2016 Sahil Sareen""";
         if (opponent_engine != null)
             opponent_engine.stop ();
 
-        base.shutdown ();
-    }
-
-    public void quit_game ()
-    {
         autosave ();
 
         /* Save window state */
@@ -217,8 +212,12 @@ Copyright © 2015–2016 Sahil Sareen""";
         settings.set_boolean ("maximized", window.maximized);
         settings.apply ();
 
+        base.shutdown ();
+    }
+
+    public void quit_game ()
+    {
         window.destroy ();
-        window = null;
     }
 
     private void autosave ()


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]