News:

Simutrans Sites
Know our official sites. Find tools and resources for Simutrans.

Bug - Crash on cancelling replace

Started by fbfree, September 25, 2011, 10:23:28 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

fbfree

In the savegame http://simutrans-germany.com/files/upload/NZ1856.sve, convoy 221 is the last convoy to be replaced on the route.  If one clicks the 'replace' button for this convoy and clicks 'clear', the replace button on the convoy information screen remains depressed when in any other game I've started it pops back up, cancelling the replace cycle.  If I close the replace dialogue and click the replace button again, the program crashes.  The replace occurs normally if I do nothing.

Initially, line (25) had 6 convoys in it, of which 'replace all' was selected with a replace cycle of 1 replace and 1 skip.  Since that time, line (25)'s schedule had been modified, several other convoys from another line had been added to line (25), and some of line (25)'s convoys had been sent to the depot and upgraded manually.  I have not been able to reproduce this behaviour from a virgin map or the default game on loading, although I did not test the effects of changes to the line during the replace cycle.

This bug occurs in both experimental 9.12 and 10.1 for linux x386, using pak-brit-exp 0.8, and 1GB ram.

jamespetts

You have managed to unearth a very obscure bug! I am not quite sure what causes it ultimately, but, somehow, the replace datum loses track of which convoys it is supposed to be replacing, so, when the datum is cleared, the convoy still thinks that it has a replace datum attached to it (hence the depressed button), and, when you go into it (by depressing the button), it crashes, as it is trying to read a memory location that has been deleted. I have fixed this now on my 10.x branch by checking whenever a player opens the replace dialogue that the convoy invoking it is indeed in the list of convoys, and adding it if it is not.

I expect that the cause is related to the fact that you had been tinkering with the convoys when the replace was in progress, although it would take for ever to work out how exactly, and this workaround seems to work effectively without side effects.

Thank you for your report!
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.