GNOME Bugzilla – Bug 724389
Critical warnings after restarting game
Last modified: 2014-04-01 23:33:05 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.
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 :)
(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
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
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()
Er, it's still happening if the clock is above one minute when Reset Game is pressed. I haven't sufficiently investigated why
(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.
(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.)
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.)
Created attachment 272672 [details] [review] Fix critical warning in Game.timeout_cb
Attachment 272672 [details] pushed as b0fa74c - Fix critical warning in Game.timeout_cb