Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The game crashes when taking a screenshot #723

Open
LSpadix opened this issue Mar 9, 2025 · 6 comments
Open

The game crashes when taking a screenshot #723

LSpadix opened this issue Mar 9, 2025 · 6 comments

Comments

@LSpadix
Copy link

LSpadix commented Mar 9, 2025

My operating system is Linux Mint 22.1 Xia, and when I try to take a screenshot, the game crashes with the following two lines of error:

free(): invalid next size (normal)
./run-tsc.sh: line 7: 13093 Aborted (core dumped) ./bin/tsc

Is there something odd going on with this "free()" function?

@Quintus
Copy link
Member

Quintus commented Mar 9, 2025 via email

@LSpadix
Copy link
Author

LSpadix commented Mar 9, 2025

Sorry, I'm still very new to this stuff. How do I do a "gdb stack trace"?

@Quintus
Copy link
Member

Quintus commented Mar 9, 2025

Sorry, I'm still very new to this stuff. How do I do a "gdb stack >trace"?

Compile TSC in debug mode (-DCMAKE_BUILD_TYPE=Debug). If you used build-tsc.sh to compile TSC, this is already the case. You can see it if you open build-tsc.sh in your favourite editor.

Then run TSC like this:

$ gdb </path/to/tsc>/bin/tsc
gdb> r
...now play until it crashes. gdb will take control of your terminal again then, while keeping the programme in RAM
gdb> bt
...this will output the stacktrace with file names and line numbers

You can end the debugging session with quit.

The stacktrace contains the complete stack of function invocations that lead to the crash, starting from main(), complete with source code file names and line numbers. This is what makes it so useful.

You can also edit run-tsc.sh to always run TSC with gdb. Change the line

./bin/tsc

to

gdb ./bin/tsc

in order to achieve that.

GDB is incredibly useful for debugging problems like this. It’s worth to learn it. Full docs: https://sourceware.org/gdb/current/onlinedocs/gdb.html/

-quintus

@LSpadix
Copy link
Author

LSpadix commented Mar 9, 2025

It only got worse. The game froze when I took the screenshot and I was not able to move my mouse or alt+f4 to get out of it. I had to kill the process using the task manager and the terminal (I was lucky, because I had to access those programs using my keyboard only). I ran the program using GDB and it gave me more information, but only at the beginning. When the game crashed, it gave me the exact same error and nothing more. However, the message changed a little bit when I tried this error again yesterday. It say "double free or corruption (!frev)", so your hypothesis might be right. I'm trying to see what's going on in void cVideo::Save_Screenshot(void), which is in video.cpp, which is the function that's being called when taking screenshots.

@Quintus
Copy link
Member

Quintus commented Mar 10, 2025 via email

@LSpadix
Copy link
Author

LSpadix commented Mar 10, 2025

If you say so, then the situation might be even worse than I though, and that's because I found out that the only way for me to reproduce the crash is to go in fullscreen mode with the highest resolution available for my computer (other resolutions don't crash the game, not even in fullscreen), which is a resolution of 1366x768. I tried to reproduce the crash in a lot of resolutions (including the highest one) while in windowed mode with no success, because the screenshot function actually works and doesn't crash the game in that mode.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants