GNOME Bugzilla – Bug 103562
The Final Solution for Undo/Redo Bugs
Last modified: 2012-01-31 23:22:27 UTC
I have created a patch to fix all the recurring undo/redo bugs in the various solitaire games. The problem is that the main sol.scm code provides no standard way for individual game modules to save the state of the game for when the user hits the undo button. For example: seahaven needs to keep track of how many free reserves are present at any one time. As noted in bug #65242: if an undo action changed the number of cards on the reserve then the program gets very confused. The traditional fix (and the original one for #65242) is to redefine the undo and redo routines, which duplicates code with only minor modifications. In the new code the individual games are no longer responsible for saving any state variables. Instead they are registered using a modified "define" routine (called "def-save-var") and the main sol.scm code takes care of saving and restoring them. This supercedes the fixes applied for bugs #65242 and #91101, it provides a probable fix for #83517 and fixes two similar bugs not previously detected in glenwood and eight_off (both of these are hard to trigger. I have not seen them misbehave, although the code clearly has the potential). I have given this the GNOMEVER2.3 keyword because the code is largely untested and while it is a bug-fix is probably not appropriate for 2.2 even though it fixes known bugs. Although it should in fact apply to almost any aisleriot version. I have tested it briefly to verify that all the games are still playable and in the case of some (seahaven, bakers_game and plait) I have verified that undo and redo work properly. In the other cases I have merely verified that nothing unexpected occured.
Created attachment 13575 [details] [review] A revamped undo/redo system for aisleriot
One additional comment: I have systematically gone through all the all the aisleriot games looking for probable bugs of this nature. Unless someone has used an unusual idiom in their code I should have found all the problem areas. The only other possible remaining problem of this type are the cases where I decided that the variable was "local" to a small cluster of routines and wouldn't need saving. I may not have got these cases correct. Of course these sorts of claims are just asking for me to be proven wrong.
Dude, you rock. Thanks!
Right, committed to HEAD. Lets see how well it works!
This bug is being reassigned to the "general" component so we can close the aisleriot bugzilla component. Apologies for the mass email!