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 721722 - Game ended due to time, but 1s is left on timer
Game ended due to time, but 1s is left on timer
Status: RESOLVED FIXED
Product: gnome-chess
Classification: Applications
Component: General
3.11.x
Other Linux
: High minor
: ---
Assigned To: Michael Catanzaro
gnome-chess-maint
Depends on:
Blocks:
 
 
Reported: 2014-01-07 19:59 UTC by Michael Catanzaro
Modified: 2014-12-05 16:15 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
1s left (47.15 KB, image/png)
2014-01-07 19:59 UTC, Michael Catanzaro
  Details
Bug fix (1.19 KB, patch)
2014-06-15 10:14 UTC, Nikhar
needs-work Details | Review
Fix game ending with 1s left on timer (2.86 KB, patch)
2014-09-15 23:13 UTC, Michael Catanzaro
committed Details | Review

Description Michael Catanzaro 2014-01-07 19:59:01 UTC
Created attachment 265567 [details]
1s left

See screenshot
Comment 1 Nikhar 2014-06-15 10:14:30 UTC
Created attachment 278475 [details] [review]
Bug fix

The timer should now correctly display 0 seconds when time runs out.
Comment 2 Mario Wenzel 2014-06-16 18:55:31 UTC
I would say that this looks good and is minimally invasive. Michael will do a proper review, once he is back.

Thanks :)
Comment 3 Michael Catanzaro 2014-06-17 23:16:39 UTC
Review of attachment 278475 [details] [review]:

Good job, Nikhar. You pinpointed the code that was wrong and found a solution that seems to work.

I think we need to be even more careful here, though, since there's no guarantee which callback will be invoked first.  I think the best way to do this would be to remove timer_expired_cb() completely, and check whether the timer has expired at the bottom of tick_cb() instead.  (This probably has to be done after calling tick() because tick() is the signal that causes the timer labels to be updated.)
Comment 4 Michael Catanzaro 2014-09-15 23:13:32 UTC
The following fix has been pushed:
072e12f Fix game ending with 1s left on timer
Comment 5 Michael Catanzaro 2014-09-15 23:13:35 UTC
Created attachment 286244 [details] [review]
Fix game ending with 1s left on timer
Comment 6 Sahil Sareen 2014-12-05 16:15:04 UTC
072e12f broke the pause functionality and is the root cause for BUG741119.

Pause works fine till c65d952. 
I'll come up with a patch for fixing 741119 soon.