The International Simutrans Forum

Development => Patches & Projects => Incorporated Patches and Solved Bug Reports => Topic started by: donjuan on September 13, 2013, 12:25:14 PM

Title: Crash when changing player
Post by: donjuan on September 13, 2013, 12:25:14 PM
Tested paks: pak64, pak128 (seems to be a pak independent bug)
Simutrans Version: 112.3-r6520

How to reproduce:
1. Just open (at last) two depot windows (No matter which kind of depot: Tram ,Train, Shipyard,Garage or Hangar)
2. Now click on "change player" (P+ -Symbol), to play as "public player", the game will crash immediately.

Can anybody confirm this bug?
Title: Re: Crash when changing player
Post by: prissi on September 13, 2013, 01:51:57 PM
Yes, it is a stack overflow. Closing depots is not needed anymore, as simutrans will ask for confirmation before you can do something with a locked player.
Title: Re: Crash when changing player
Post by: Dwachs on September 13, 2013, 03:47:35 PM
Here is a patch. Prissi what you described are just the symptoms of bugs deeper in the window management:

1) destroy_win could create a cascade of topwin/destroywin calls - just do not call topwin if window is not destroyed directly. The topwin call has to be done after process_kill_list.

2) this is more serious: if in destroy_framed_win the wins pointer points to a member of kill_list and this member gets removed, then wins->gui points to some other gui accidentally ...

Could not test nor commit due to not compiling :/
Title: Re: Crash when changing player
Post by: prissi on September 13, 2013, 03:58:53 PM
Thank you, I also noticed that there was indeed some other problem with destruction handling. However, if got distracted by finding out if leaving depots open would allow any unwanted stuff. Your patch look fine.