Complete.Org: Mailing Lists: Archives: freeciv-dev: March 2006:
[Freeciv-Dev] Re: (PR#15937) Editor: is_edit_mode client/server mismatch
Home

[Freeciv-Dev] Re: (PR#15937) Editor: is_edit_mode client/server mismatch

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: kaufman@xxxxxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#15937) Editor: is_edit_mode client/server mismatch causes infinite loop
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 16 Mar 2006 19:40:11 -0800
Reply-to: bugs@xxxxxxxxxxx

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

Mike Kaufman wrote:
> <URL: http://bugs.freeciv.org/Ticket/Display.html?id=15937 >
> 
> if you start a standalone server, connect a client to it, switch to editing
> mode, then disconnect and reconnect to the server without turning off edit
> mode first, the client will go into an infinite loop (and probably cause
> the server to become unusable as well.
> 
> The reason this happens is that the game info packet to the client calls
> update_menus(). update_menus() calls
> menus_set_active("<main>/_Editor/Editing Mode", game.info.is_edit_mode);
> 
> which if the checkitem changes, sends a toggle callback to
> key_editor_toggle(), which sends a packet to the server, which starts the
> whole thing again.

Hopefully this patch (untested) should fix it.  This is the same way all 
the other toggle items in the menus work.

-jason

Index: client/gui-gtk-2.0/menu.c
===================================================================
--- client/gui-gtk-2.0/menu.c   (revision 11776)
+++ client/gui-gtk-2.0/menu.c   (working copy)
@@ -597,7 +597,9 @@
 {   
   switch(callback_action) {
   case MENU_EDITOR_TOGGLE:
-    key_editor_toggle();
+    if (game.info.is_edit_mode ^ GTK_CHECK_MENU_ITEM(widget)->active) {
+      key_editor_toggle();
+    }
     break;
   case MENU_EDITOR_TOOLS:
     editdlg_show_tools();

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] Re: (PR#15937) Editor: is_edit_mode client/server mismatch causes infinite loop, Jason Short <=