Complete.Org: Mailing Lists: Archives: freeciv-dev: September 2004:
[Freeciv-Dev] (PR#10386) Civserver segfaults on consider_settler_action(
Home

[Freeciv-Dev] (PR#10386) Civserver segfaults on consider_settler_action(

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: evyscr@xxxxxxxxx
Subject: [Freeciv-Dev] (PR#10386) Civserver segfaults on consider_settler_action()
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 30 Sep 2004 08:07:58 -0700
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=10386 >

This patch reverts Per's fix and puts in a proper one.  I will commit
immediately.

Per's fix breaks the freelog.  Of course we could just remove the
freelog, but it's easy to fix properly.

jason

Index: server/settlers.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/settlers.c,v
retrieving revision 1.207
diff -u -r1.207 settlers.c
--- server/settlers.c   30 Sep 2004 12:17:16 -0000      1.207
+++ server/settlers.c   30 Sep 2004 15:06:46 -0000
@@ -847,15 +847,15 @@
   if (total_value > *best_value
       || (total_value == *best_value
          && old_tile_value > *best_old_tile_value)) {
-    *best_value = total_value;
-    *best_old_tile_value = old_tile_value;
-    *best_act = act;
-    *best_tile = ptile;
     freelog(LOG_DEBUG,
            "Replacing (%d, %d) = %d with %s (%d, %d) = %d [d=%d b=%d]",
            TILE_XY(*best_tile), *best_value, get_activity_text(act),
            TILE_XY(ptile), total_value,
             delay, base_value);
+    *best_value = total_value;
+    *best_old_tile_value = old_tile_value;
+    *best_act = act;
+    *best_tile = ptile;
   }
 }
 
@@ -1502,7 +1502,7 @@
   struct player *pplayer = city_owner(pcity);
   struct unit *virtualunit;
   int want;
-  struct tile *best_tile;
+  struct tile *best_tile = NULL; /* May be accessed by freelog() calls. */
   enum unit_activity best_act;
   struct tile *ptile = pcity->tile;
   struct ai_data *ai = ai_data_get(pplayer);

[Prev in Thread] Current Thread [Next in Thread]