Complete.Org: Mailing Lists: Archives: freeciv-dev: December 2004:
[Freeciv-Dev] (PR#11722) Gtk 2.0 client crash, City dialog, Change menu
Home

[Freeciv-Dev] (PR#11722) Gtk 2.0 client crash, City dialog, Change menu

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: badamson@xxxxxxxxxxx
Subject: [Freeciv-Dev] (PR#11722) Gtk 2.0 client crash, City dialog, Change menu
From: "Vasco Alexandre da Silva Costa" <vasc@xxxxxxxxxxxxxx>
Date: Thu, 30 Dec 2004 14:07:43 -0800
Reply-to: bugs@xxxxxxxxxxx

<URL: http://bugs.freeciv.org/Ticket/Display.html?id=11722 >

> [badamson@xxxxxxxxxxx - Wed Dec 29 19:12:36 2004]:
> 
> If I select a city in the city dialog, then click on the 'Change' entry 
> on the menu bar, the client crashes. The problem is reproduceable. This 
> is the Gtk 2.0 client of the development version of 2004-12-29, using 
> Debian GNU/Linux 'sarge', gcc 3.3.5 (Debian 1:3.3.5-5).

...

> I'm unfamiliar with the client code, but it seems that 
> append_impr_or_unit_to_menu_item is assuming that cid_is_unit(cid) will 
> always return true, becaue it passes a NULL as pcity.

Actually, the bug was in get_city_dialog_production_row. When I changed
this code for the gen imprs patch I forgot pcity could be NULL. Here is
a fix. Thanks for the detailed bug report.

Index: client/citydlg_common.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/citydlg_common.c,v
retrieving revision 1.54
diff -u -r1.54 citydlg_common.c
--- client/citydlg_common.c     19 Dec 2004 19:22:30 -0000      1.54
+++ client/citydlg_common.c     30 Dec 2004 22:05:20 -0000
@@ -329,7 +329,7 @@
     }
     my_snprintf(buf[2], column_size, "%d", unit_build_shield_cost(id));
   } else {
-    struct player *pplayer = city_owner(pcity);
+    struct player *pplayer = game.player_ptr;
 
     /* Total & turns left meaningless on capitalization */
     if (building_has_effect(id, EFT_PROD_TO_GOLD)) {
@@ -356,7 +356,7 @@
        }
        if (is_small_wonder(id)) {
          state = _("Small Wonder");
-         if (find_city_from_small_wonder(city_owner(pcity), id)) {
+         if (find_city_from_small_wonder(pplayer, id)) {
            state = _("Built");
          }
          if (improvement_obsolete(pplayer, id)) {

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