After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 705878 - abandoned game reappears on restart
abandoned game reappears on restart
Status: RESOLVED FIXED
Product: gnome-chess
Classification: Applications
Component: General
git master
Other Linux
: Normal normal
: ---
Assigned To: Michael Catanzaro
gnome-chess-maint
Depends on:
Blocks:
 
 
Reported: 2013-08-12 23:20 UTC by Adam Dingle
Modified: 2013-08-25 19:13 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Remove game from history after "Abandon Game" (1.33 KB, patch)
2013-08-13 15:45 UTC, Michael Catanzaro
committed Details | Review
Try really hard to not stack games in history (1.48 KB, patch)
2013-08-19 03:28 UTC, Michael Catanzaro
committed Details | Review
Remove ChessHistory class (11.79 KB, patch)
2013-08-24 14:17 UTC, Michael Catanzaro
none Details | Review
Remove ChessHistory class (12.15 KB, patch)
2013-08-24 14:19 UTC, Michael Catanzaro
committed Details | Review

Description Adam Dingle 2013-08-12 23:20:43 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.
Comment 1 Michael Catanzaro 2013-08-13 03:43:55 UTC
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.
Comment 2 Michael Catanzaro 2013-08-13 15:41:26 UTC
(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.
Comment 3 Michael Catanzaro 2013-08-13 15:45:53 UTC
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.
Comment 4 Adam Dingle 2013-08-14 11:24:36 UTC
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?
Comment 5 Adam Dingle 2013-08-14 11:25:31 UTC
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.
Comment 6 Michael Catanzaro 2013-08-14 13:33:43 UTC
(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 7 Michael Catanzaro 2013-08-14 13:34:37 UTC
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"
Comment 8 Adam Dingle 2013-08-14 13:37:24 UTC
(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.
Comment 9 Michael Catanzaro 2013-08-19 03:28:22 UTC
The following fix has been pushed:
25126e7 Try really hard to not stack games in history
Comment 10 Michael Catanzaro 2013-08-19 03:28:25 UTC
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.
Comment 11 Michael Catanzaro 2013-08-24 14:17:54 UTC
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.
Comment 12 Michael Catanzaro 2013-08-24 14:19:36 UTC
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.
Comment 13 Michael Catanzaro 2013-08-25 18:06:18 UTC
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
Comment 14 Adam Dingle 2013-08-25 19:13:28 UTC
hooray!