News:

Simutrans Wiki Manual
The official on-line manual for Simutrans. Read and contribute.

[Crash] During generating map on sources from [2020.08.01]

Started by Hanczar, July 31, 2020, 11:58:04 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Hanczar

It looks like it is introduced by recent change:

commit d553de9664d24239978d258fc4ad0caf3804e336
Author: jamespetts <jamespetts@yahoo.com>
Date:   Thu Jul 30 16:14:33 2020 +0100

    FIX: Loss of network synchronisation when editing one way roads in some cases

callstack:
strasse_t::set_overtaking_mode (this=this@entry=0x55559d863c00, o=o@entry=twoway_mode, calling_player=calling_player@entry=0x0) at boden/wege/../../player/simplay.h:264
264             bool is_public_service() const { return player_nr == 1; }
(gdb) bt
#0  strasse_t::set_overtaking_mode (this=this@entry=0x55559d863c00, o=o@entry=twoway_mode, calling_player=calling_player@entry=0x0) at boden/wege/../../player/simplay.h:264
#1  0x00005555555a74f2 in bridge_builder_t::build_ramp (player=player@entry=0x0, end=..., ribi_neu=ribi_neu@entry=2 '\002', weg_hang=<optimized out>, desc=desc@entry=0x5555590b9860, way_desc=way_desc@entry=0x55557245bf50, overtaking_mode=twoway_mode, beginning=true) at bauer/brueckenbauer.cc:1127
#2  0x00005555555a7a9a in bridge_builder_t::build_bridge (player=player@entry=0x0, start=..., end=..., zv=..., bridge_height=<optimized out>, desc=desc@entry=0x5555590b9860, way_desc=0x55557245bf50, overtaking_mode=twoway_mode) at bauer/brueckenbauer.cc:824
#3  0x000055555580c36a in bridge_builder_t::build_bridge (way_desc=<optimized out>, desc=0x5555590b9860, bridge_height=<optimized out>, zv=..., end=..., start=..., player=0x0) at bauer/brueckenbauer.h:100
#4  stadt_t::build_road (this=this@entry=0x55559dda8eb0, k=..., player_=player_@entry=0x0, forced=forced@entry=false, map_generation=map_generation@entry=true) at simcity.cc:5406
#5  0x000055555580cb91 in stadt_t::maybe_build_road (this=this@entry=0x55559dda8eb0, k=..., k@entry=..., map_generation=map_generation@entry=true) at simcity.h:143
#6  0x000055555580d524 in stadt_t::build (this=this@entry=0x55559dda8eb0, new_town=new_town@entry=false, map_generation=map_generation@entry=true) at simcity.cc:5569
#7  0x0000555555811d2f in stadt_t::step_grow_city (this=this@entry=0x55559dda8eb0, new_town=new_town@entry=false, map_generation=map_generation@entry=true) at simcity.cc:3132
#8  0x000055555581207d in stadt_t::change_size (this=0x55559dda8eb0, delta_citizen=delta_citizen@entry=128, new_town=<optimized out>, map_generation=map_generation@entry=true) at simcity.cc:2633
#9  0x00005555558bc6ef in karte_t::distribute_cities (this=this@entry=0x55557ab377d0, sets=sets@entry=0x55557ab377d0, old_x=old_x@entry=0, old_y=old_y@entry=0) at simworld.cc:1079
#10 0x00005555558cfb15 in karte_t::distribute_groundobjs_cities (this=this@entry=0x55557ab377d0, sets=sets@entry=0x55557ab377d0, old_x=old_x@entry=0, old_y=old_y@entry=0) at simworld.cc:1357
#11 0x00005555558d0d79 in karte_t::enlarge_map (this=this@entry=0x55557ab377d0, sets=sets@entry=0x55557ab377d0, h_field=h_field@entry=0x0) at simworld.cc:2922
#12 0x00005555558db594 in karte_t::init (this=0x55557ab377d0, sets=0x555555a39280 <env_t::default_settings>, h_field=h_field@entry=0x0) at simworld.cc:1505
#13 0x000055555573c876 in welt_gui_t::action_triggered (this=0x55557b48f3e0, comp=0x55557b491188, v=...) at gui/../simworld.h:2753
#14 0x000055555567a803 in gui_action_creator_t::call_listeners (v=..., this=0x55557b491188) at gui/components/gui_action_creator.h:35
#15 button_t::infowin_event (this=0x55557b491168, ev=0x7fffffffb7a0) at gui/components/gui_button.cc:235
#16 0x000055555567df28 in gui_container_t::infowin_event (this=this@entry=0x55557b48f3e8, ev=ev@entry=0x7fffffffb810) at gui/components/gui_container.cc:196
#17 0x00005555556bd45b in gui_frame_t::infowin_event (this=this@entry=0x55557b48f3e0, ev=ev@entry=0x7fffffffb880) at gui/gui_frame.cc:142
#18 0x000055555573b30d in welt_gui_t::infowin_event (this=0x55557b48f3e0, ev=0x7fffffffb880) at gui/welt.cc:706
#19 0x000055555572ac19 in check_pos_win (ev=ev@entry=0x7fffffffb900) at gui/simwin.cc:1423
#20 0x0000555555872c47 in modal_dialogue (gui=gui@entry=0x55557b48f3e0, magic=magic@entry=4, welt=welt@entry=0x55557ab377d0, quit=quit@entry=0x5555558729fe <never_quit()>) at simmain.cc:250
#21 0x0000555555877264 in simu_main (argc=argc@entry=1, argv=argv@entry=0x7fffffffe0a8) at simmain.cc:1383
#22 0x00005555558872a1 in sysmain (argc=1, argv=0x7fffffffe0a8) at simsys.cc:830
#23 0x000055555594f533 in main (argc=<optimized out>, argv=<optimized out>) at simsys_s2.cc:789

Build from current sources (091ddf97716cad3b3286c1aed8ba3ddb521d460c).

Platform: Ubuntu 20.04
Reason seems to be calling_player during map generation is NULL (nullptr), which is dereferenced in afromentioned callstack.

Hanczar

Such minor change seems help for this problem and map generates successfully


git diff ./strasse.cc
diff --git a/boden/wege/strasse.cc b/boden/wege/strasse.cc
index 7e0c561bf..0357daa69 100644
--- a/boden/wege/strasse.cc
+++ b/boden/wege/strasse.cc
@@ -281,6 +281,7 @@ void strasse_t::rdwr(loadsave_t *file)

void strasse_t::set_overtaking_mode(overtaking_mode_t o, player_t* calling_player)
{
+       if (!calling_player) {return;}
        if (o == invalid_mode) { return; }
        grund_t* gr = welt->lookup(get_pos());
        if (!calling_player->is_public_service() && is_public_right_of_way() && gr && gr->removing_way_would_disrupt_public_right_of_way(road_wt))

jamespetts

In the time that you were posting the second message, I have pushed a fix for this: thank you for your report and sorry that you have had trouble.

I should be grateful if you could re-test with to-morrow's nightly build.
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.

Hanczar

I confirm that this problem is fixed in latest sources.