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

On 29/08/2007, Marko Lindqvist <[EMAIL PROTECTED]> wrote:
> On 29/08/07, Michael Kaufman <[EMAIL PROTECTED]> wrote:
> >
> > The last time I checked, not doing a client reset on player switch caused
> > bad things to happen, but I can't be more specific than that.
>
>  Then S2_1 solution would probably be to make even more complete
> reset, setting also player->nation to NULL for all players.
>  Actually, player->nation reset should be added to
> handle_ruleset_control() in any case for player->nation->player
> consistency.

 This patch adds player->nation reset after nation->player has been
reseted in handle_ruleset_control(). This should fix several client
end player->nation->player inconsistency crashes, and it helps against
crash in this ticket too.


 - ML

diff -Nurd -X.diff_ignore freeciv/client/packhand.c freeciv/client/packhand.c
--- freeciv/client/packhand.c	2007-08-21 21:41:47.000000000 +0300
+++ freeciv/client/packhand.c	2007-08-30 22:39:28.000000000 +0300
@@ -2118,6 +2118,12 @@
   nations_alloc(packet->nation_count);
   city_styles_alloc(packet->styles_count);
 
+  /* After nation ruleset free/alloc, nation->player pointers are NULL.
+   * We have to initialize player->nation too, to keep state consistent. */ 
+  players_iterate(pplayer) {
+    pplayer->nation = NO_NATION_SELECTED;
+  } players_iterate_end;
+
   if (packet->prefered_tileset[0] != '\0') {
     /* There is tileset suggestion */
     if (strcmp(packet->prefered_tileset, tileset_get_name(tileset))) {
_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to