[gnome-chess/gnome-3-10] Never claim the engine has died when all is well
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-chess/gnome-3-10] Never claim the engine has died when all is well
- Date: Tue, 7 Jan 2014 20:55:20 +0000 (UTC)
commit 63411e0e2c8397b7e8b932ad301f6686267b8ae1
Author: Michael Catanzaro <mcatanzaro gnome org>
Date: Tue Jan 7 14:17:18 2014 -0600
Never claim the engine has died when all is well
Currently we display an erroneous "Oops! Something has gone wrong" if
you start a new game within two seconds of having completed the previous
game.
Incindentally fixes https://bugzilla.gnome.org/show_bug.cgi?id=721671
src/gnome-chess.vala | 11 +++++++++--
1 files changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/src/gnome-chess.vala b/src/gnome-chess.vala
index beae26c..7729b83 100644
--- a/src/gnome-chess.vala
+++ b/src/gnome-chess.vala
@@ -676,10 +676,17 @@ public class Application : Gtk.Application
* game is likely to end naturally first. (And in the off chance that
* the game really is over but it takes more than two seconds for us to
* figure that out, something really HAS gone wrong.)
+ *
+ * This is complicated a bit more because we have to be sure we're
+ * stopping the original, presumably-buggy game, and not a new one that
+ * the player just happens to have started two seconds after the last
+ * game finished normally.
*/
+ var original_game = game;
Timeout.add_seconds (2, () => {
- game.stop (ChessResult.BUG, ChessRule.BUG);
- /* Disconnect from the mainloop */
+ if (game == original_game)
+ game.stop (ChessResult.BUG, ChessRule.BUG);
+ /* Disconnect from the main loop */
return false;
});
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]