The International Simutrans Forum

Development => Patches & Projects => Topic started by: ArthurDenture on March 31, 2013, 07:54:08 PM

Title: Patch: fix segfault on startup when fonts aren't found
Post by: ArthurDenture on March 31, 2013, 07:54:08 PM
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.
Title: Re: Patch: fix segfault on startup when fonts aren't found
Post by: prissi on March 31, 2013, 10:48:14 PM
Printing to stderr will not show the message on windows ... Thanks
Title: Re: Patch: fix segfault on startup when fonts aren't found
Post by: ArthurDenture on March 31, 2013, 10:50:53 PM
Should I use dbg->error() instead? What's preferred? I see a variety of ways of printing error messages in the source code.
Title: Re: Patch: fix segfault on startup when fonts aren't found
Post by: prissi on March 31, 2013, 10:51:52 PM
The dbg subsystem may not be initialized such early on. I need to check this.
Title: Re: Patch: fix segfault on startup when fonts aren't found
Post by: ArthurDenture on April 06, 2013, 01:59:07 PM
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.)
Title: Re: Patch: fix segfault on startup when fonts aren't found
Post by: Ters on April 06, 2013, 02:12:26 PM
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.