[Freeciv-Dev] (PR#10860) core dumps on Leave
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://rt.freeciv.org/Ticket/Display.html?id=10860 >
Here is a fix, to be commited ASAP.
Index: client/gui-gtk-2.0/dialogs.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk-2.0/dialogs.c,v
retrieving revision 1.77
diff -u -r1.77 dialogs.c
--- client/gui-gtk-2.0/dialogs.c 31 Oct 2004 20:45:54 -0000 1.77
+++ client/gui-gtk-2.0/dialogs.c 7 Nov 2004 14:12:55 -0000
@@ -2120,6 +2120,9 @@
{
GList *res;
+ gui_dialog_destroy_all();
+
+
res = gtk_window_list_toplevels();
g_list_foreach(res, (GFunc)g_object_ref, NULL);
Index: client/gui-gtk-2.0/gui_stuff.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk-2.0/gui_stuff.c,v
retrieving revision 1.15
diff -u -r1.15 gui_stuff.c
--- client/gui-gtk-2.0/gui_stuff.c 31 Oct 2004 20:45:54 -0000 1.15
+++ client/gui-gtk-2.0/gui_stuff.c 7 Nov 2004 14:12:56 -0000
@@ -32,6 +32,10 @@
#include "gui_stuff.h"
+
+static GList *dialog_list;
+
+
/**************************************************************************
...
**************************************************************************/
@@ -305,6 +309,7 @@
*(dlg->source) = NULL;
}
+ dialog_list = g_list_remove(dialog_list, dlg);
free(dlg);
}
@@ -374,6 +379,8 @@
GtkWidget *vbox, *action_area;
dlg = fc_malloc(sizeof(*dlg));
+ dialog_list = g_list_prepend(dialog_list, dlg);
+
dlg->source = pdlg;
*pdlg = dlg;
@@ -753,6 +760,20 @@
}
/**************************************************************************
+ Destroy all dialogs.
+**************************************************************************/
+void gui_dialog_destroy_all(void)
+{
+ GList *it, *it_next;
+
+ for (it = dialog_list; it; it = it_next) {
+ it_next = g_list_next(it);
+
+ gui_dialog_destroy((struct gui_dialog *)it->data);
+ }
+}
+
+/**************************************************************************
Set the response callback for a dialog.
**************************************************************************/
void gui_dialog_response_set_callback(struct gui_dialog *dlg,
Index: client/gui-gtk-2.0/gui_stuff.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk-2.0/gui_stuff.h,v
retrieving revision 1.10
diff -u -r1.10 gui_stuff.h
--- client/gui-gtk-2.0/gui_stuff.h 31 Oct 2004 20:45:54 -0000 1.10
+++ client/gui-gtk-2.0/gui_stuff.h 7 Nov 2004 14:12:56 -0000
@@ -101,6 +101,7 @@
void gui_dialog_raise(struct gui_dialog *dlg);
void gui_dialog_alert(struct gui_dialog *dlg);
void gui_dialog_destroy(struct gui_dialog *dlg);
+void gui_dialog_destroy_all(void);
GtkWidget *gui_dialog_get_toplevel(struct gui_dialog *dlg);
void gui_dialog_response_set_callback(struct gui_dialog *dlg,
GUI_DIALOG_RESPONSE_FUN fun);
|
|