Author: cazfi
Date: Tue Nov  3 17:42:06 2015
New Revision: 30387

URL: http://svn.gna.org/viewcvs/freeciv?rev=30387&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:
    branches/S2_5/server/citytools.c

Modified: branches/S2_5/server/citytools.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/server/citytools.c?rev=30387&r1=30386&r2=30387&view=diff
==============================================================================
--- branches/S2_5/server/citytools.c    (original)
+++ branches/S2_5/server/citytools.c    Tue Nov  3 17:42:06 2015
@@ -1609,6 +1609,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);
 
   BV_CLR_ALL(had_small_wonders);
   city_built_iterate(pcity, pimprove) {
@@ -1653,8 +1654,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;
          }
@@ -1666,7 +1666,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);
     }
@@ -1699,7 +1699,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);
@@ -1711,10 +1711,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

Reply via email to