[Bug] Access violation after loading game (r2287 and some previous) February 02, 2009, 10:13:02 pm Abstract: after saving and loading a game using PakBritain with a train in a depot, the game crashes with an access violation when the train is set to go.Steps to reproduce:(1) use the unofficial PakBritain distribution for version 100.0;(2) start a new game;(3) run some track and a depot (in my tests, I used the improved wooden sleeper track);(4) set a train with a schedule to run up and down the track, between waypoints, but do not start it;(5) save the game;(6) quit;(7) start Simutrans again, and load the game;(8) open the depot window and start the train.Note: the crash may happen in more varied circumstances than those described above, but those are known steps to reproduce it. The access violation occurs in grund.cc at line 453 (as at r2287), which reads:Code: [Select]if(flags&has_way1) {The debugger shows that the variable "flags" is not set, and returns an "ERROR: Expression cannot be evaluated" when one attempts to ascertain the value. This appears to be the proximate cause of the crash. I tested this with a clean version of Simutrans to eliminate the possibility of my patches causing the error. The crash also appears on the 101.0 stable binary in like circumstances. I consider this a Simutrans bug rather than a PakBritain bug, because no program should ever produce an access violation no matter how incorrect the data files (even if PakBritain's data files are to blame, which is not clear - I have some recollection of having this problem in Pak128, but I cannot reproduce it at present). Quote Selected
Re: [Bug] Access violation after loading game (r2287 and some previous) Reply #1 – February 03, 2009, 08:22:02 am THis bug has been fixed in the nightlies. It was also the last fix before releasing 101 if memory servers me right.And if a pak set have faulty files, simutrans will crash sometimes. I could check everywhere; but then the probgram will be way slower. Furthermore, people will get sloppy about paks and there will be more paks with errors and more checks required. A nice nasty example is HTML ... Quote Selected
Re: [Bug] Access violation after loading game (r2287 and some previous) Reply #2 – February 03, 2009, 11:16:47 am Prissi,hmm - I used nightly r2287 (clean - without any of my patches) to test it, with a new saved game, and it still produced that result. Can you think of any error in a pakset that could cause this to happen? We might get a clearer idea when TheHood releases all the source files, of course... Quote Selected
Re: [Bug] Access violation after loading game (r2287 and some previous) Reply #3 – February 03, 2009, 01:21:58 pm It works in pak128 and pak64. Thus I am not sure what the reason is. You have MSVC, thus you see the debug histroy. The error seems like there was no ground (this=0x0 for grund). Giving the calling histroy one my find this error much easier. Or put you pak128 savegame.I cannot install every current pak set, since there is too much going on. If it is reproducable, I may have a look.Is is from trains, trams or narrowgauge? Quote Selected
Re: [Bug] Access violation after loading game (r2287 and some previous) Reply #4 – February 03, 2009, 02:06:01 pm Prissi,thank you for your reply. As requested, call history (in reverse chronological order):1. Code: [Select]if(flags&has_way1) { in grund_t2. Code: [Select]schiene_t * sch0 = dynamic_cast<schiene_t *>( welt->lookup(fahr[i]->get_pos())->get_weg(fahr[i]->get_waytype()) ); in convoi_t3. Code: [Select] if(!route.empty()) { vorfahren() in convoi_t4. Code: [Select]cnv->step(); in karte_t.I cannot presently reproduce this with pak128, and the PakBritain savegame was too large to attach, so I uploaded it to Simutrans files: http://simutrans-germany.com/files/upload/Save%20test.sve . The problem as I have diagnosed it appears with trains - I have not attempted to reproduce it with trams or narrow gauge (I do not know of any current paksets featuring narrow gauge). The odd thing is, the problem only appears after saving and re-loading the game: it does not occur if the game is played without reloading. Quote Selected