Complete.Org: Mailing Lists: Archives: freeciv-dev: December 2002:
[Freeciv-Dev] Re: (PR#2679) XAW client dumping core when used with isome
Home

[Freeciv-Dev] Re: (PR#2679) XAW client dumping core when used with isome

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Cc: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#2679) XAW client dumping core when used with isometric tileset?
From: "Jason Short via RT" <rt@xxxxxxxxxxxxxx>
Date: Mon, 30 Dec 2002 22:33:49 -0800
Reply-to: rt@xxxxxxxxxxxxxx

On Mon, 2002-12-30 at 18:39, ChrisK@xxxxxxxx via RT wrote:

> 1.14.1 HEAD CVS 30 DEC 2002 Linux i386 Xaw3d
> 
> chris@max:~> LANG= civclient -t isotrident -P none
> 1: Client does not support isometric tilesets. Using default tileset
> instead.
> civclient: support.c:212: mystrlcpy: Assertion 'src != ((void *)0)' failed.
> Abgebrochen (core dumped)

Ahh, this is in HEAD.

This is the same bug that causes the "current tileset" (in local
options) to be empty when you start the client without using -t.  IMO
the logic used to determine the tileset is backwards: NULL or "" is
passed in to mean there is no tileset specified, and the loading code
detects this case and falls back onto the default tileset.  This means
the only place we are guaranteed to know the name of the tileset we're
loading is in the innermost function, tilespec_fullname().  So either
the check must go there or the logic should be reversed.  But right now
it goes in the calling function, which means NULL or "" is copied into
the "current tileset" string.

This patch just moves the check.  This just makes the current ugly
situation even uglier.  But it should work.

jason


Index: client/tilespec.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/tilespec.c,v
retrieving revision 1.101
diff -u -r1.101 tilespec.c
--- client/tilespec.c   2002/12/30 20:57:51     1.101
+++ client/tilespec.c   2002/12/31 06:27:25
@@ -157,6 +157,10 @@
     tileset_name = tileset_default;
   }
 
+  /* Hack: this is the name of the tileset we're about to load.  We copy
+   * it here, since this is the only place where we know it. */
+  sz_strlcpy(current_tile_set_name, tileset_name);
+
   fname = fc_malloc(strlen(tileset_name) + strlen(TILESPEC_SUFFIX) + 1);
   sprintf(fname, "%s%s", tileset_name, TILESPEC_SUFFIX);
   
@@ -455,8 +459,6 @@
   section_file_free(file);
   freelog(LOG_VERBOSE, "finished reading %s", fname);
   free(fname);
-
-  sz_strlcpy(current_tile_set_name, tileset_name);
 }
 
 /**********************************************************************

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