News:

Simutrans Wiki Manual
The official on-line manual for Simutrans. Read and contribute.

Patch: fix segfault on startup when fonts aren't found

Started by ArthurDenture, March 31, 2013, 07:54:08 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

ArthurDenture

This is just a small side effect of my work trying to port to SDL2. I noticed a segfault when trying to run from a directory that didn't have the full set of support files. Anyhow, it was simply due to a return code not being checked. The attached patch turns the segfault into a clean exit with an error.


The patch was produced with git but should apply cleanly at svn revision 6423.

prissi

Printing to stderr will not show the message on windows ... Thanks

ArthurDenture

Should I use dbg->error() instead? What's preferred? I see a variety of ways of printing error messages in the source code.

prissi

The dbg subsystem may not be initialized such early on. I need to check this.

ArthurDenture

I was going to go check this out further, but it seems this was accepted as r6427, thanks. :-)

(Fwiw, I do see that simgraph_init is for sure preceded by logging setup. No idea what happens on Windows w.r.t. printing to stderr, though.)

Ters

Quote from: ArthurDenture on April 06, 2013, 01:59:07 PM
(Fwiw, I do see that simgraph_init is for sure preceded by logging setup. No idea what happens on Windows w.r.t. printing to stderr, though.)

I think it's pretty much the same as with simutrans 2> /dev/null on *nix.