Complete.Org: Mailing Lists: Archives: freeciv-dev: November 2004:
[Freeciv-Dev] Re: (PR#10927) Crash freeciv beta3 linux
Home

[Freeciv-Dev] Re: (PR#10927) Crash freeciv beta3 linux

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: nijpels@xxxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#10927) Crash freeciv beta3 linux
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Sun, 7 Nov 2004 10:00:28 -0800
Reply-to: rt@xxxxxxxxxxx

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

Geert Nijpels wrote:
> <URL: http://rt.freeciv.org/Ticket/Display.html?id=10927 >
> 
> On Sun, 7 Nov 2004 01:54:14 -0800, Jason Short
> <jdorje@xxxxxxxxxxxxxxxxxxxxx> wrote:
> 
>><URL: http://rt.freeciv.org/Ticket/Display.html?id=10927 >
>>
>>>[nijpels@xxxxxxxxxx - Sun Nov 07 09:03:59 2004]:
>>
>>>(civclient:23998): GLib-GObject-CRITICAL **: file gsignal.c: line 1634
>>>(g_signal_connect_data): assertion `G_TYPE_CHECK_INSTANCE (instance)'
>>
>>failed
>>
>>>civclient: mapview_common.c:2330: overview_to_map_pos: Assertion `0'
>>
>>failed.

Well, here is a patch to just work around the bug.  It will only apply 
to S2_0 since the dev branch has rather different code here.  For the 
dev branch I think we're better off without this "fix" but if we want it 
it'll be even easier to do there.

jason

? freeciv-2.0.0-beta3.tar.gz
Index: client/mapview_common.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/mapview_common.c,v
retrieving revision 1.151.2.6
diff -u -r1.151.2.6 mapview_common.c
--- client/mapview_common.c     24 Oct 2004 23:48:42 -0000      1.151.2.6
+++ client/mapview_common.c     7 Nov 2004 17:58:39 -0000
@@ -2318,6 +2318,7 @@
 {
   int ntl_x = overview_x / OVERVIEW_TILE_SIZE + overview.map_x0;
   int ntl_y = overview_y / OVERVIEW_TILE_SIZE + overview.map_y0;
+  struct tile *ptile;
 
   if (MAP_IS_ISOMETRIC && !topo_has_flag(TF_WRAPX)) {
     /* Clip half tile left and right.  See comment in map_to_overview_pos. */
@@ -2325,10 +2326,12 @@
   }
 
   NATURAL_TO_MAP_POS(map_x, map_y, ntl_x, ntl_y);
-  if (!normalize_map_pos(map_x, map_y)) {
-    /* All positions on the overview should be valid. */
-    assert(FALSE);
-  }
+
+  /* HACK: there are reports of normalize_map_pos failing here, so we use
+   * nearest_real_tile instead. */
+  ptile = nearest_real_tile(*map_x, *map_y);
+  *map_x = ptile->x;
+  *map_y = ptile->y;
 }
 
 /**************************************************************************

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