Solitaire: Maybe fix rare crash from completing a game with TAB (#8217)

The crash happens very rarely and is hard to reproduce so it is
hard to know for certain, but I am confident this fixes it.

I previously delayed the start of the game-over animation by one
frame, but neglected to check m_start_game_over_animation_next_frame
wasn't set. This means multiple calls to start_game_over_animation()
on the same frame (or rather, before the first timer_event) would
each call Object::start_timer(). Now that we do check the flag,
that should no longer be possible.

Fixes #8122.
This commit is contained in:
Sam Atkins 2021-06-24 08:25:01 +01:00 committed by GitHub
parent bd5a04fffe
commit f2d6cac692
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
Notes: sideshowbarker 2024-07-18 11:36:10 +09:00

View file

@ -85,7 +85,7 @@ void Game::set_background_fill_enabled(bool enabled)
void Game::start_game_over_animation()
{
if (m_game_over_animation)
if (m_game_over_animation || m_start_game_over_animation_next_frame)
return;
m_last_move = {};