[Freeciv-Dev] (PR#10700) Bug, beta2, client, linux, network dialog
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://rt.freeciv.org/Ticket/Display.html?id=10700 >
> [gvdmer@xxxxxxxxx - Sun Oct 24 03:21:18 2004]:
>
> The freeciv client crashes in the "Connect to network game" dialog if
> you click refresh two or more times fast. this only occurs if there
> are already servers listed. I think it happens if the gui hasnt sorted
> itself out yet (eg. the button doesnt respond when you click on it)
> BTW this was refreshing internet servers.
Seems the bug was due to multiple timeouts being running at a time, then
one free'ed a necessary memory structured on exit which shortly
afterwards the other timeout tried to read. This patch should fix it.
Index: client/gui-gtk-2.0/pages.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk-2.0/pages.c,v
retrieving revision 1.1.2.4
diff -u -u -r1.1.2.4 pages.c
--- client/gui-gtk-2.0/pages.c 23 Oct 2004 19:39:19 -0000 1.1.2.4
+++ client/gui-gtk-2.0/pages.c 24 Oct 2004 04:18:50 -0000
@@ -274,6 +274,16 @@
}
/**************************************************************************
+ this function frees the list of LAN servers on timeout destruction.
+**************************************************************************/
+static void get_lan_destroy(gpointer data)
+{
+ finish_lanserver_scan();
+ num_lanservers_timer = 0;
+ lan_timer = 0;
+}
+
+/**************************************************************************
this function updates the list of LAN servers every 100 ms for 5 seconds.
**************************************************************************/
static gboolean get_lan_list(gpointer data)
@@ -303,12 +313,10 @@
num_lanservers_timer++;
if (num_lanservers_timer == 50) {
- finish_lanserver_scan();
- num_lanservers_timer = 0;
- lan_timer = 0;
return FALSE;
+ } else {
+ return TRUE;
}
- return TRUE;
}
/**************************************************************************
@@ -322,11 +330,12 @@
append_output_window(errbuf);
}
- if (num_lanservers_timer == 0) {
+ if (lan_timer == 0) {
gtk_list_store_clear(lan_store);
if (begin_lanserver_scan()) {
- lan_timer = g_timeout_add(100, get_lan_list, NULL);
+ lan_timer = g_timeout_add_full(G_PRIORITY_DEFAULT, 100,
+ get_lan_list, NULL, get_lan_destroy);
}
}
}
@@ -1490,7 +1499,6 @@
case PAGE_NETWORK:
if (lan_timer != 0) {
g_source_remove(lan_timer);
- lan_timer = 0;
}
break;
case PAGE_GAME:
- [Freeciv-Dev] (PR#10700) Bug, beta2, client, linux, network dialog, Gustav Van Der Merwe, 2004/10/23
- [Freeciv-Dev] (PR#10700) Bug, beta2, client, linux, network dialog,
Vasco Alexandre da Silva Costa <=
|
|