[gnome-chess] 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] Never claim the engine has died when all is well
- Date: Tue, 7 Jan 2014 20:55:36 +0000 (UTC)
commit e138e994c66c4ceae007cd75ccf02ee1d72702ca
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 c6e0e0b..61302d6 100644
--- a/src/gnome-chess.vala
+++ b/src/gnome-chess.vala
@@ -650,10 +650,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]