Bug 481546 - Crash at the end of a game with 2 CPU players
Summary: Crash at the end of a game with 2 CPU players
Status: RESOLVED FIXED
Alias: None
Product: knights
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Arch Linux Linux
: NOR crash
Target Milestone: ---
Assignee: Alexander Semke
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-02-19 15:12 UTC by dawid.trendota
Modified: 2024-03-06 21:30 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
Frame stack (1.01 KB, text/x-log)
2024-02-19 15:12 UTC, dawid.trendota
Details

Note You need to log in before you can comment on or make changes to this bug.
Description dawid.trendota 2024-02-19 15:12:15 UTC
Created attachment 165936 [details]
Frame stack

At the end of the game with 2 CPU players, the Manager::gameOver is called twice. It cause the Game Over - Knights dialog to appear twice as well.

At the close of second dialog:

*** Program received signal SIGSEGV (Segmentation fault) ***
*** Exited on signal SIGSEGV ***

***
NOTE: If you are reporting a crash, please try to attach a backtrace with debug symbols.
See https://community.kde.org/Guidelines_and_HOWTOs/Debugging/How_to_create_useful_crash_reports
***


STEPS TO REPRODUCE
1. Start application
2. Start new game with 2 CPU, GNU Chess, Time Control 1 minute
3. Wait till end of the game
4. Close both game over dialogs
5. Crash

OBSERVED RESULT

Crash, two Game Over dialogs.

EXPECTED RESULT

No crash, probably single Game Over dialog.

SOFTWARE/OS VERSIONS
Archlinux
master branch of Knights, commit 3572b3f4

https://invent.kde.org/games/knights/-/commit/3572b3f4e79b57b5a56248100cc8652c219bac06

ADDITIONAL INFORMATION
Reproducing this issue might be difficult without applying the fix 3572b3f4, as another crash will occur earlier.
Comment 1 Albert Astals Cid 2024-02-19 19:12:08 UTC
Can you reproduce this all the time?

Are you working on it like on the other crash or you need help with this one?
Comment 2 dawid.trendota 2024-02-19 20:24:43 UTC
(In reply to Albert Astals Cid from comment #1)
> Can you reproduce this all the time?
> 
> Are you working on it like on the other crash or you need help with this one?

I was able to reproduce it all the time. I am working on it.
Comment 3 Bug Janitor Service 2024-02-19 23:54:07 UTC
A possibly relevant merge request was started @ https://invent.kde.org/games/knights/-/merge_requests/23
Comment 4 Albert Astals Cid 2024-03-06 21:29:21 UTC
Git commit 9e808d3198c4cf744bd5624e01c2092677d6988c by Albert Astals Cid, on behalf of Dawid Trendota.
Committed on 06/03/2024 at 21:26.
Pushed by aacid into branch 'master'.

Fix crash during game over

Add condition to check if Manager::gameOver was not called already.

M  +3    -5    src/gamemanager.cpp

https://invent.kde.org/games/knights/-/commit/9e808d3198c4cf744bd5624e01c2092677d6988c
Comment 5 Albert Astals Cid 2024-03-06 21:30:24 UTC
Git commit a7a87731b7474bd7e993a02fd408eace3bfd949d by Albert Astals Cid, on behalf of Dawid Trendota.
Committed on 06/03/2024 at 21:30.
Pushed by aacid into branch 'release/24.02'.

Fix crash during game over

Add condition to check if Manager::gameOver was not called already.
(cherry picked from commit 9e808d3198c4cf744bd5624e01c2092677d6988c)

M  +3    -5    src/gamemanager.cpp

https://invent.kde.org/games/knights/-/commit/a7a87731b7474bd7e993a02fd408eace3bfd949d