GNOME Bugzilla – Bug 705878
abandoned game reappears on restart
Last modified: 2013-08-25 19:13:28 UTC
To see the problem: 1. Start a game and make a few moves. 2. Press the New Game button. 3. Press Abandon Game in the resulting dialog. 4. Exit and restart gnome-chess. You'll now see the game in progress from step 1. Instead, you should see a fresh game since you already abandoned the previous game. In other words, every time you restart gnome-chess, you should see exactly what you saw before exiting; that's not happening in this case.
When I follow those steps in master, I get a fresh new game. But I can reproduce by adding one more step to that example: 1. Start a game and make a few moves. 2. New step: exit and restart gnome-chess (you see the game in progress, as expected) 3. Press the New Game button. 4. Press Abandon Game in the resulting dialog. 5. Exit and restart gnome-chess. (you see the original game in progress) Which doesn't make much sense. "Abandon game" should really delete the game just as surely as if you'd resigned. (In reply to comment #0) > In other words, every time you restart gnome-chess, you should see exactly what > you saw before exiting; that's not happening in this case. I think that would suffice (and lead to fewer bugs and less user confusion); one autosaved game is really enough. But it currently saves a stack of incomplete games and presents you with the most recent incomplete game on start.
(In reply to comment #1) > When I follow those steps in master, I get a fresh new game. But I can > reproduce by adding one more step to that example: Er, I can reproduce it today following your example... I wonder what was up when I tried yesterday.
Created attachment 251510 [details] [review] Remove game from history after "Abandon Game" When starting a new game despite not having completed the current game, the user may choose to either "Abandon Game" or to save the game. However, Abandon Game currently autosaves the game so that it will be loaded in the future. This is annoying as the user explicitly decided to not save the game. Actually discard the game in this scenario.
I just tried this patch. Apparently there is still a stack of incomplete games which I have saved up from previous runs of gnome-chess, and now each time I abandon and restart I see another previous game from that stack. Can we simply make Abandon Game clear that stack entirely for the sake of existing users?
Or, can we simply eliminate the data structure that holds that stack of games? I don't see why gnome-chess ever needs to hold more than the current game.
(In reply to comment #5) > Or, can we simply eliminate the data structure that holds that stack of games? > I don't see why gnome-chess ever needs to hold more than the current game. I'd rather remove it completely, yes. We actually have a dependency on SQLite solely for maintaining this stack of unsaved games.
Comment on attachment 251510 [details] [review] Remove game from history after "Abandon Game" Leaving the bug open for now, as per above Attachment 251510 [details] pushed as 2c9ccb7 - Remove game from history after "Abandon Game"
(In reply to comment #6) > (In reply to comment #5) > > Or, can we simply eliminate the data structure that holds that stack of games? > > I don't see why gnome-chess ever needs to hold more than the current game. > > I'd rather remove it completely, yes. We actually have a dependency on SQLite > solely for maintaining this stack of unsaved games. Ouch! Sounds like a great opportunity to simplify the code.
The following fix has been pushed: 25126e7 Try really hard to not stack games in history
Created attachment 252175 [details] [review] Try really hard to not stack games in history I don't have time to remove the history class before 3.9.90. In the mean time, let's just make very sure that we never have more than one game in history by deleting everything before adding one. Obviously a massive FIXME, but the only thing the user will notice is that autosave/autoload works as expected.
Created attachment 253012 [details] [review] Remove ChessHistory class I'm not sure why this class originally existed, but currently it's only used to maintain a stack of autosaved games, so that after completing the first autoloaded game on the stack, the next time you start the game the next game on the stack will be autoloaded. This feature was determined to be undesirable -- we'd really like only one game to be autoloaded at a time -- so I added a delete query to ChessHistory such that all the previous games on the stack would be removed when a new one was added. But that meant an SQLite database was used to store exactly one game. Let's drop this. We can also remove the dependency on SQLite.
Created attachment 253013 [details] [review] Remove ChessHistory class I'm not sure why this class originally existed, but currently it's only used to maintain a stack of autosaved games, so that after completing the first autoloaded game on the stack, the next time you start the game the next game on the stack will be autoloaded. This feature was determined to be undesirable -- we'd really like only one game to be autoloaded at a time -- so I added a delete query to ChessHistory such that all the previous games on the stack would be removed when a new one was added. But that meant an SQLite database was used to store exactly one game. Let's drop this. We can also remove the dependency on SQLite.
Since there's no user-visible change, I'm going to say that removing SQLite is not a new feature. Pushed for 3.9.91. Attachment 253013 [details] pushed as cd6a238 - Remove ChessHistory class
hooray!