Complete.Org: Mailing Lists: Archives: freeciv-dev: June 2004:
[Freeciv-Dev] (PR#8977) client crash when exiting client
Home

[Freeciv-Dev] (PR#8977) client crash when exiting client

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] (PR#8977) client crash when exiting client
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 14 Jun 2004 13:32:41 -0700
Reply-to: rt@xxxxxxxxxxx

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

> [jdorje - Sun Jun 13 16:49:27 2004]:

> cache3.results is NULL while MAX_FIELDS_USED is 20.  But I have no
idea why.

I still have no idea why.  But this should fix it.

jason

Index: common/city.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/city.c,v
retrieving revision 1.218
diff -u -r1.218 city.c
--- common/city.c       13 Jun 2004 03:57:04 -0000      1.218
+++ common/city.c       14 Jun 2004 20:30:05 -0000
@@ -28,6 +28,8 @@
 #include "packets.h"
 #include "support.h"
 
+#include "cm.h"
+
 #include "city.h"
 
 /* start helper functions for generic_city_refresh */
@@ -238,6 +240,8 @@
 #endif
 
   city_map_iterate_outwards_indices = array;
+
+  cm_init_citymap();
 }
 
 /**************************************************************************
Index: common/aicore/cm.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/aicore/cm.c,v
retrieving revision 1.25
diff -u -r1.25 cm.c
--- common/aicore/cm.c  13 Jun 2004 03:57:05 -0000      1.25
+++ common/aicore/cm.c  14 Jun 2004 20:30:05 -0000
@@ -1152,10 +1152,6 @@
   struct tile_stats tile_stats;
   bool is_celebrating = base_city_celebrating(pcity);
 
-  cache3.results
-    = fc_realloc(cache3.results,
-                (MAX_FIELDS_USED + 1) * sizeof(*cache3.results));
-
   if (cache3.pcity != pcity) {
     cache3.pcity = NULL;
   } else {
@@ -1438,6 +1434,16 @@
 }
 
 /****************************************************************************
+  Call this function when the citymap size (city_tiles) has changed.
+****************************************************************************/
+void cm_init_citymap(void)
+{
+  cache3.results
+    = fc_realloc(cache3.results,
+                (MAX_FIELDS_USED + 1) * sizeof(*cache3.results));
+}
+
+/****************************************************************************
 ...
 *****************************************************************************/
 void cm_free(void)
Index: common/aicore/cm.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/aicore/cm.h,v
retrieving revision 1.5
diff -u -r1.5 cm.h
--- common/aicore/cm.h  29 May 2004 20:34:31 -0000      1.5
+++ common/aicore/cm.h  14 Jun 2004 20:30:05 -0000
@@ -60,10 +60,8 @@
   int specialists[SP_COUNT];
 };
 
-/*
- * ...
- */
 void cm_init(void);
+void cm_init_citymap(void);
 
 /*
  * ...

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