The International Simutrans Forum

Simutrans Extended => Simutrans-Extended bug reports => Simutrans-Extended development => Simutrans-Extended closed bug reports => Topic started by: Matthew on June 19, 2018, 04:49:56 PM

Title: Reproducible crash from the Change Prices window
Post by: Matthew on June 19, 2018, 04:49:56 PM
Steps to reproduce:
1. Start a new map in the railway era (e.g. 1850)
2. Build some railway track and a depot
3. Open the depot, add a loco
4. Add a carriage of a certain class (e.g. Low) and change it to a different class (e.g. Very low)
5. Now add another carriage of that certain class (in the example, Low), and don't change it
6. Open the 'Change prices' window and it will display 'Reassigned to multiple classes'
7. Click the right arrow to change the class to 'Very high'
8. Click the left arrow to go back again and the game will crash with this message:
"FATAL ERROR: vector.tpl<T>::[] - t: index out of bounds: 5 not 0..4
Aborting program execution..."

The same crash happens when steps 6 to 8 are followed while the train is outside the depot.
Title: Re: Reproducible crash from the Change Prices window
Post by: jamespetts on June 23, 2018, 01:00:07 PM
Thank you for the report - I think that I have now fixed this - I should be grateful if you could re-test with the next nightly build.
Title: Re: Reproducible crash from the Change Prices window
Post by: ACarlotti on June 24, 2018, 07:55:39 AM
James: Your fix only catches the problem at a very low level; those numbers should never be getting there in the first place.

The underlying issue is that 'reassigned to multiple' gets treated as a sixth class in the vehicle class manager. I have pushed a fix to this (and a related off-by-one error that prevented this being caught elsewhere). The primary change is that 'reassigned to multiple' is ignored if selected, and removed from the list when something else is selected.

I have since noticed that a different fix for this underlying issue is already present for the line class manager. As far as I can tell this latter fix will not work in general for a network game, where the dialogue will probably be redrawn before the vehicle class reassignment is actually changed.

In any case, I think these two dialogues should eventually be merged (i.e. refactored to use the same code), but this should probably wait until the new gui currently being developed for Standard is included in Extended.
Title: Re: Reproducible crash from the Change Prices window
Post by: jamespetts on June 24, 2018, 10:50:13 AM
Thank you for that - that is most helpful.