Complete.Org: Mailing Lists: Archives: freeciv-dev: July 2005:
[Freeciv-Dev] (PR#13557) cityrep worklist crash
Home

[Freeciv-Dev] (PR#13557) cityrep worklist crash

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] (PR#13557) cityrep worklist crash
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 28 Jul 2005 11:50:06 -0700
Reply-to: bugs@xxxxxxxxxxx

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

Trying to use the worklist operations in the city report quickly leads
to this crash:

#0  0x08091581 in is_great_wonder (id=67) at improvement.c:408
#1  0x08091170 in is_wonder (id=67) at improvement.c:206
#2  0x08059fcd in collect_cids1 (dest_cids=0xbfffe9bc,
    selected_cities=0x8c705f8, num_selected_cities=1, append_units=false,
    append_wonders=false, change_prod=true,
    test_func=0x8059bd2 <city_can_build_impr_or_unit>) at climisc.c:696
#3  0x080d9584 in append_impr_or_unit_to_menu_item (parent_item=0x8c14388,
    append_units=false, append_wonders=false, city_operation=CO_FIRST,
    test_func=0x8059bd2 <city_can_build_impr_or_unit>,
    callback=0x80d9a6d <select_impr_or_unit_callback>, size=1) at
cityrep.c:246
#4  0x080db6bb in popup_first_menu (menu=0x8c7d3c0, data=0x0) at
cityrep.c:1332

This patch fixes it.  Eventually we should make the query functions more
robust but for now it's useful to get crashes on these errors.

-jason

Index: client/climisc.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/climisc.c,v
retrieving revision 1.172
diff -p -u -r1.172 climisc.c
--- client/climisc.c    26 Jul 2005 16:35:56 -0000      1.172
+++ client/climisc.c    28 Jul 2005 18:49:11 -0000
@@ -685,7 +685,7 @@ int collect_cids1(cid * dest_cids, struc
                  bool (*test_func) (struct city *, int))
 {
   cid first = append_units ? B_LAST : 0;
-  cid last = append_units ? game.control.num_unit_types + B_LAST : B_LAST;
+  cid last = append_units ? game.control.num_unit_types + B_LAST : 
game.control.num_impr_types;
   cid cid;
   int items_used = 0;
 

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#13557) cityrep worklist crash, Jason Short <=