Complete.Org: Mailing Lists: Archives: freeciv-dev: February 2003:
[Freeciv-Dev] Re: (PR#3476) all > 1 client are crashing
Home

[Freeciv-Dev] Re: (PR#3476) all > 1 client are crashing

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: ue80@xxxxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#3476) all > 1 client are crashing
From: "Raimar Falke" <rf13@xxxxxxxxxxxxxxxxx>
Date: Wed, 19 Feb 2003 10:31:17 -0800
Reply-to: rt@xxxxxxxxxxxxxx

On Wed, Feb 19, 2003 at 08:05:38AM -0800, ue80@xxxxxxxxxxxxxxxxxxxxx wrote:
> 
> Hi,
> 
> when starting localy a game with more than 1 client i get:
> #43534 0x080c6d0b in build_required_techs_helper (pplayer=0x81c7348,
> tech=0, 
>     goal=0) at tech.c:107
> #43535 0x080c6d0b in build_required_techs_helper (pplayer=0x81c7348,
> tech=0, 
>     goal=0) at tech.c:107
> #43536 0x080c6d75 in build_required_techs (pplayer=0x81c7348, goal=0)
>     at tech.c:129
> #43537 0x080c6e60 in update_research (pplayer=0x81c7348) at tech.c:181
> #43538 0x08072850 in handle_player_info (pinfo=0x8381428) at
> packhand.c:1306
> #43539 0x080644bf in handle_packet_input (packet=0x8381428,
> type=136082248)
>     at civclient.c:291
> #43540 0x08067612 in input_from_server (fd=6) at clinet.c:329
> #43541 0x4017b0aa in gdk_get_show_events () from
> /usr/lib/libgdk-1.2.so.0
> #43542 0x401a9e00 in g_io_add_watch () from /usr/lib/libglib-1.2.so.0
> #43543 0x401ab4c8 in g_get_current_time () from
> /usr/lib/libglib-1.2.so.0
> #43544 0x401abad3 in g_get_current_time () from
> /usr/lib/libglib-1.2.so.0
> #43545 0x401abc6c in g_main_run () from /usr/lib/libglib-1.2.so.0
> #43546 0x400cd7f7 in gtk_main () from /usr/lib/libgtk-1.2.so.0
> #43547 0x08094fc0 in ui_main (argc=1, argv=0xbffffc34) at gui_main.c:935
> #43548 0x08064002 in main (argc=1, argv=0xbffffc34) at civclient.c:240

There are two problems here. One stupid and one quite complicated.

The easy one not testing if the nation is in the given class. See the
attached patch.

The second is that if you are in the SELECT_RACES_STATE state and you
have two clientes and now one client disconnects (core dump from above
or plain C-c) the server sends the other client a player_info about
the now disconnected player. This player_info packet however hasn't
player->research.inventions initialed yet (no client choosed the
nation yet). This however now causes A_NONE be unknown and so causes
an recursion like in PR#2788. Patch also attached (which includes an
assert to test for A_NONE-is-known).

        Raimar

-- 
 email: rf13@xxxxxxxxxxxxxxxxx
 "Understanding is a three-edged sword; 
  your side, their side, and the truth."
    -- a well-known Vorlon

Index: client/packhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/packhand.c,v
retrieving revision 1.291
diff -u -u -r1.291 packhand.c
--- client/packhand.c   2003/02/17 22:49:27     1.291
+++ client/packhand.c   2003/02/19 18:28:29
@@ -1303,7 +1303,11 @@
   }
   pplayer->reputation = pinfo->reputation;
 
-  read_player_info_techs(pplayer, pinfo->inventions);
+  pplayer->is_connected=pinfo->is_connected;
+
+  if (pplayer->is_connected) {
+    read_player_info_techs(pplayer, pinfo->inventions);
+  }
 
   poptechup = (pplayer->research.researching!=pinfo->researching);
   pplayer->research.bulbs_researched = pinfo->bulbs_researched;
@@ -1332,8 +1336,6 @@
   pplayer->turn_done=pinfo->turn_done;
   pplayer->nturns_idle=pinfo->nturns_idle;
   pplayer->is_alive=pinfo->is_alive;
-  
-  pplayer->is_connected=pinfo->is_connected;
 
   pplayer->ai.barbarian_type = pinfo->barbarian_type;
   pplayer->revolution=pinfo->revolution;
Index: common/tech.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/tech.c,v
retrieving revision 1.57
diff -u -u -r1.57 tech.c
--- common/tech.c       2003/02/12 22:22:34     1.57
+++ common/tech.c       2003/02/19 18:28:37
@@ -164,6 +164,8 @@
   Tech_Type_id i;
   enum tech_flag_id flag;
 
+  assert(get_invention(pplayer, A_NONE) == TECH_KNOWN);
+
   for (i = 0; i < game.num_tech_types; i++) {
     if (!tech_exists(i)) {
       set_invention(pplayer, i, TECH_UNKNOWN);
Index: client/gui-gtk/dialogs.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk/dialogs.c,v
retrieving revision 1.123
diff -u -u -r1.123 dialogs.c
--- client/gui-gtk/dialogs.c    2003/02/17 02:11:25     1.123
+++ client/gui-gtk/dialogs.c    2003/02/19 18:28:34
@@ -2339,12 +2339,12 @@
 
     for (i = 0; i < packet->num_nations_used; i++) {
       int nation = packet->nations_used[i];
+      int index =
+         g_list_index(sorted_races_list[class_id], GINT_TO_POINTER(nation));
 
-      gtk_widget_set_sensitive(races_toggles[class_id][g_list_index
-                                                      (sorted_races_list
-                                                       [class_id],
-                                                       GINT_TO_POINTER
-                                                       (nation))], FALSE);
+      if (index != -1) {
+       gtk_widget_set_sensitive(races_toggles[class_id][index], FALSE);
+      }
     }
   }
 

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