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 724389 - Critical warnings after restarting game
Critical warnings after restarting game
Status: RESOLVED FIXED
Product: gnome-mahjongg
Classification: Applications
Component: general
3.11.x
Other Linux
: Normal minor
: ---
Assigned To: gnome-mahjongg-maint
gnome-mahjongg-maint
Depends on:
Blocks:
 
 
Reported: 2014-02-14 23:23 UTC by Michael Catanzaro
Modified: 2014-04-01 23:33 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Stop the timer when resetting the game (723 bytes, patch)
2014-02-20 01:20 UTC, Michael Catanzaro
committed Details | Review
Fix critical warning in Game.timeout_cb (1.14 KB, patch)
2014-03-23 01:29 UTC, Michael Catanzaro
committed Details | Review

Description Michael Catanzaro 2014-02-14 23:23:42 UTC
I got to the dialog that appears when you have no moves left, offering undo/restart/newgame/shuffle.  I clicked restart.  I got tons of the following warning, past my terminal scrollback:

(gnome-mahjongg:11336): GLib-CRITICAL **: g_timer_elapsed: assertion 'timer != NULL' failed

This continued I think until I actually made a move in the new game, starting the timer.
Comment 1 Chirag Mehta 2014-02-19 15:30:19 UTC
Michael: I tried to solve the bug, what i found was, at the position when we have no moves left and choose restart option, it calls     "game_view.game.reset"     method, where you have set    
<clock = null;>            which is generating the bug, I'm trying to fix it, by choosing an alternative of that line, suggestions welcomed :)
Comment 2 Chirag Mehta 2014-02-19 18:21:12 UTC
(In reply to comment #0)
> I got to the dialog that appears when you have no moves left, offering
> undo/restart/newgame/shuffle.  I clicked restart.  I got tons of the following
> warning, past my terminal scrollback:
> 
> (gnome-mahjongg:11336): GLib-CRITICAL **: g_timer_elapsed: assertion 'timer !=
> NULL' failed
> 
> This continued I think until I actually made a move in the new game, starting
> the timer.

i tried doing "clock  = new Timer (); " instead of <clock = null > which is wrong as it starts the timer as soon we press restart and does not wait for the user to make first move, reply as soon as possible
Comment 3 Michael Catanzaro 2014-02-20 01:20:41 UTC
It's actually correct that we destroy clock there. The problem is that either timer_cb() needs to not attempt to use clock if it is null, or else we need to ensure clock is always valid before entering timer_cb(). Unscheduling timer_cb() seems cleaner

The following fix has been pushed:
51d0e06 Stop the timer when resetting the game
Comment 4 Michael Catanzaro 2014-02-20 01:20:48 UTC
Created attachment 269744 [details] [review]
Stop the timer when resetting the game

This fixes a spew of critical warnings when we attempt to use a null
clock in Game.timeout_cb()
Comment 5 Michael Catanzaro 2014-02-20 06:06:11 UTC
Er, it's still happening if the clock is above one minute when Reset Game is pressed.  I haven't sufficiently investigated why
Comment 6 Chirag Mehta 2014-02-20 12:10:09 UTC
(In reply to comment #5)
> Er, it's still happening if the clock is above one minute when Reset Game is
> pressed.  I haven't sufficiently investigated why

Michael : I'l look into it, and why are you not on irc channel of #gnome-games ?
and i tried the solution you you attached but didn't upload due to the same problem.
Comment 7 Michael Catanzaro 2014-02-21 01:13:29 UTC
(In reply to comment #6)
> Michael : I'l look into it, and why are you not on irc channel of #gnome-games
> ?

I'm just now trying to get into the habit of using IRC, so I'm not on as often as I should be, sorry.  (But this comment came at 6:10 AM CST, a time where I can guarantee I will not be present! During the week I would only ever be around in the American evening.)
Comment 8 Michael Catanzaro 2014-02-26 14:22:33 UTC
Another way to fix this for sure would be to simply return from timeout_cb if the timer is null.  (I haven't pushed that yet because I'm curious why we're getting there in the first place.)
Comment 9 Michael Catanzaro 2014-03-23 01:29:52 UTC
Created attachment 272672 [details] [review]
Fix critical warning in Game.timeout_cb
Comment 10 Michael Catanzaro 2014-04-01 23:33:02 UTC
Attachment 272672 [details] pushed as b0fa74c - Fix critical warning in Game.timeout_cb