Skip to main content
Topic: [solved]r2173 - Crash when start Simutrans (Read 7880 times) previous topic - next topic

[solved]r2173 - Crash when start Simutrans

simutrans r2173 SDL, GDI

When starting simutrans, it crashed.

How to reproduce:
1. Strart Simutrans with command line "-log 1 -debug 4".
2. Change language to Japanese.
3. Quit Simutrans.
4. Strart Simutrans with command line "-log 1 -debug 4".

Result:
Crash.

Note:
If I remove "simuconf.close();" on simmain.cc line:366, simutrans don't crash.
This is the reason I rewrite the patch. But I can't understand why this causes crash with my poor c++ skill.

Code: [Select]
Message: create_win():	ins_win=0
Message: create_win(): new ins_win=1
Message: toolbar_t::init(): ID=32768d
Message: karte_t::reset_timer(): called
Message: karte_t::reset_timer(): called

Code: [Select]
sim.exe caused an Access Violation at location 005a9d78 in module sim.exe Reading from location 02303c8d.

Registers:
eax=022fb260 ebx=00f80000 ecx=000000f0 edx=00008a2d esi=00000000 edi=00000000
eip=005a9d78 esp=0023ea50 ebp=0023fa18 iopl=0         nv up ei pl nz na po nc
cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000             efl=00000206

Call stack:
005A9D78  sim.exe:005A9D78  display_calc_proportional_string_len_width(char const*, int)  simgraph16.cc:2477
...
iUnicode = utf8_to_utf16((utf8 const*)text + iLen, &iLen);
if (iUnicode == 0) return width;
> w = fnt->screen_width[iUnicode];
if (w == 0) {
// default width for missing characters
...

005ADDC3  sim.exe:005ADDC3  WinMain  simsys_w16.cc:756
00401247  sim.exe:00401247
00401298  sim.exe:00401298
7C817067  kernel32.dll:7C817067  RegisterWaitForInputIdle


Re: r2173 - Crash when start Simutrans

Reply #1
Because parsing does already a closing. Did not crash on my machine. Thank you.

Re: r2173 - Crash when start Simutrans

Reply #2
Unfortunately, r2174 still cause crash.

I wrote "line:366" but you deleted "line:395".
This doesn't solve the problem.
Sorry, I should have attached a patch.

I attached a patch.
Could you please change this ?

Re: r2173 - Crash when start Simutrans

Reply #3
for me, deleting setting.xml did circumvent the crash at startup (while the bar says 'loading map')
Parsley, sage, rosemary, and maggikraut.

Re: r2173 - Crash when start Simutrans

Reply #4
Without the first closing, I cold not p**** it. Investigating.

Re: r2173 - Crash when start Simutrans

Reply #5
In r2178, it still crash when starting.

How to reproduce:
1. Strart Simutrans with command line "-log 1 -debug 4".
2. Change language to Japanese.
3. Click "Quit" button on new map window and quit Simutrans.
4. Strart Simutrans with command line "-log 1 -debug 4".

I don't know this is gcc problem or not.
Can someone confirm this problem on linux or with MSVC ?

Re: r2173 - Crash when start Simutrans

Reply #6
But when you kill the settings.xml it works again?
I hope you understand my English

Re: r2173 - Crash when start Simutrans

Reply #7
Thank you.

But when you kill the settings.xml it works again?

Yes. But that is not a solution, because that is the problem itself.
If we use both unicode language and debug mode at the same time, it crashes at startup.
So, I can't use debug mode.

Re: r2173 - Crash when start Simutrans

Reply #8
What about 82 relase?


Re: r2173 - Crash when start Simutrans

Reply #10
I don't know who is breaking memories, but I heard some different reports.
Someone said that crash happened on starting simutrans without debug option.
And someone said that AI and Japanese language caused crash, but AI and English language didn't cause crash.
But currently I can't reprodece them.

[edit]
I don't know well but, the position of "sprachengui_t::init_font_from_lang();" on simmain.cc is too late, isn't it ?
So, it might fail to draw city name lavel and status bar message in Japanese in some cases - busy or slow performance.

In old versions, user interface was Englsh until I click the screen and open new map window.
But in this version, user interface and city name are Japanese when opened.

So, it should be done before drawing.

[edit]
Patch attached.
I don't know this is the best position or not.
But at least, "Init map ..." and "Loading map ..." for demo.sve is shown in Japanese and didn't crash for me.

Re: r2173 - Crash when start Simutrans

Reply #11
WHile it still does not crash on my system, now init new map message in japanese is shown. Seems the correct way.

Re: r2173 - Crash when start Simutrans

Reply #12
Thank you.
Unfortunately, I still have some problems as the same reason.

1. When I start as "Japanese" and change language to "Polski", simutrans crash.
2. When I start as "English" and change language to "Polski", some controll button texts shows at wrong position.

So, I will continue to testing for this.

[edit]
When I replaced "text/pl.tab" to old none-utf8 version's file, simutrans didn't have these problems.
But uft8 version of "text/pl.tab" causes these problems.

So, problems always happens with "w = fnt->screen_width[iUnicode];".
This sometimes reads from wrong places.

Re: r2173 - Crash when start Simutrans

Reply #13
Polski has prop-latin.fnt but is unicode encoding: This cannot work of course, since fnt have only 256 letters. This is a complete unrelated problem, though.

[solved]r2173 - Crash when start Simutrans

Reply #14
Thank you. Then eolved.