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

The previous patch works but is a little inefficient
in that it adds a useless call to get_server_scan_list
before a new scan is actually started. So here is
a slight variation that fixes this.


----------------------------------------------------------------------
少々お待ち下さい
diff --git a/client/gui-gtk-2.0/pages.c b/client/gui-gtk-2.0/pages.c
index f9aff6d..5883957 100644
--- a/client/gui-gtk-2.0/pages.c
+++ b/client/gui-gtk-2.0/pages.c
@@ -379,6 +379,10 @@ static void server_scan_error(struct server_scan *scan,
 **************************************************************************/
 static void update_network_lists(void)
 {
+  if (scan_timer != 0) {
+    g_source_remove(scan_timer);
+  }
+
   if (!meta) {
     meta = server_scan_begin(SERVER_SCAN_GLOBAL, server_scan_error);
   }
@@ -387,11 +391,9 @@ static void update_network_lists(void)
     lan = server_scan_begin(SERVER_SCAN_LOCAL, server_scan_error);
   }
 
-  if (scan_timer == 0) { 
-    scan_timer = g_timeout_add_full(G_PRIORITY_DEFAULT, 100,
-				    get_server_scan_list,
-				    NULL, get_server_scan_destroy);
-  }
+  scan_timer = g_timeout_add_full(G_PRIORITY_DEFAULT, 100,
+                                  get_server_scan_list,
+                                  NULL, get_server_scan_destroy);
 }
 
 /**************************************************************************
_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to