Author: cazfi Date: Tue Nov 3 17:41:53 2015 New Revision: 30385 URL: http://svn.gna.org/viewcvs/freeciv?rev=30385&view=rev Log: Avoid a couple of cases where remove_city() could a pointer to already recursively, from a called lua-script, freed city.
See bug #24016 Modified: trunk/server/citytools.c Modified: trunk/server/citytools.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/server/citytools.c?rev=30385&r1=30384&r2=30385&view=diff ============================================================================== --- trunk/server/citytools.c (original) +++ trunk/server/citytools.c Tue Nov 3 17:41:53 2015 @@ -1593,6 +1593,7 @@ const citizens old_angry_citizens = player_angry_citizens(powner); struct dbv tile_processed; struct tile_list *process_queue; + const char *ctl = city_tile_link(pcity); CALL_PLR_AI_FUNC(city_lost, powner, powner, pcity); @@ -1639,8 +1640,7 @@ E_UNIT_RELOCATED, ftc_server, _("Moved %s out of disbanded city %s " "since it cannot stay on %s."), - unit_link(punit), - city_tile_link(pcity), + unit_link(punit), ctl, terrain_name_translation(tile_terrain(pcenter))); break; } @@ -1652,7 +1652,7 @@ E_UNIT_LOST_MISC, ftc_server, _("When %s was disbanded your %s could not " "get out, and it was therefore lost."), - city_link(pcity), + ctl, unit_tile_link(punit)); wipe_unit(punit, ULR_CITY_LOST, NULL); } @@ -1685,7 +1685,7 @@ E_UNIT_LOST_MISC, ftc_server, _("When %s was disbanded your %s in %s was trapped, " "and it was therefore lost."), - city_link(pcity), + ctl, unit_tile_link(punit), city_link(other_city)); wipe_unit(punit, ULR_CITY_LOST, NULL); @@ -1697,10 +1697,11 @@ } adjc_iterate_end; } -dbv_free(&tile_processed); - tile_list_destroy(process_queue); + dbv_free(&tile_processed); + tile_list_destroy(process_queue); if (!city_exist(id)) { + /* Wiping trapped units caused city to disappear. */ return; } _______________________________________________ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits