The International Simutrans Forum

 

Author Topic: Crash when changing player  (Read 1159 times)

0 Members and 1 Guest are viewing this topic.

Offline donjuan

  • *
  • Posts: 13
  • Languages: EN,GER
Crash when changing player
« 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?

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 10828
  • Languages: De,EN,JP
Re: Crash when changing player
« Reply #1 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.

Offline Dwachs

  • DevTeam, Coder/patcher
  • Administrator
  • *
  • Posts: 4899
  • Languages: EN, DE, AT
Re: Crash when changing player
« Reply #2 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 :/

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 10828
  • Languages: De,EN,JP
Re: Crash when changing player
« Reply #3 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.