Author: cazfi
Date: Tue Nov  3 17:42:00 2015
New Revision: 30386

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

Modified: branches/S2_6/server/citytools.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/server/citytools.c?rev=30386&r1=30385&r2=30386&view=diff
==============================================================================
--- branches/S2_6/server/citytools.c    (original)
+++ branches/S2_6/server/citytools.c    Tue Nov  3 17:42:00 2015
@@ -1587,6 +1587,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);
 
@@ -1633,8 +1634,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;
          }
@@ -1646,7 +1646,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);
     }
@@ -1679,7 +1679,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);
@@ -1691,10 +1691,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