[Freeciv-Dev] Re: (PR#6885) Remove memory leaks in xaw with quit_freeciv
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: |
undisclosed-recipients: ; |
Subject: |
[Freeciv-Dev] Re: (PR#6885) Remove memory leaks in xaw with quit_freeciv |
From: |
"Raimar Falke" <i-freeciv-lists@xxxxxxxxxxxxx> |
Date: |
Mon, 1 Dec 2003 11:34:37 -0800 |
Reply-to: |
rt@xxxxxxxxxxx |
<URL: http://rt.freeciv.org/Ticket/Display.html?id=6885 >
On Sun, Nov 16, 2003 at 05:15:24AM -0800, Vasco Alexandre da Silva Costa wrote:
>
> <URL: http://rt.freeciv.org/Ticket/Display.html?id=6885 >
>
> On Sun, 16 Nov 2003, Raimar Falke wrote:
>
> >
> > <URL: http://rt.freeciv.org/Ticket/Display.html?id=6885 >
> >
> >
> > The xaw client doesn't leave the ui_main function in a normal
> > way. This leaves a lot of memory still allocated. The attached patch
> > fixes this.
>
> How about calling it ui_exit instead of quit_freeciv, to keep the naming
> consistent?
I changed the name and converted another instance of exit(). I
attached the patch which I applied.
Raimar
--
email: rf13@xxxxxxxxxxxxxxxxx
"Many of my assistants were fans of Tolkien, who wrote 'Lord of the Rings'
and a number of other children's stories for adults. The first character
alphabet that was programmed for my plotter was Elvish rather than Latin."
-- from SAIs "life as a computer for a quarter of a century"
Index: client/civclient.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/civclient.c,v
retrieving revision 1.182
diff -u -u -r1.182 civclient.c
--- client/civclient.c 2003/11/28 17:37:19 1.182
+++ client/civclient.c 2003/12/01 19:24:25
@@ -244,6 +244,17 @@
ui_main(argc, argv);
/* termination */
+ ui_exit();
+
+ /* not reached */
+ return EXIT_SUCCESS;
+}
+
+/**************************************************************************
+...
+**************************************************************************/
+void ui_exit(void)
+{
attribute_flush();
client_remove_all_cli_conn();
my_shutdown_network();
Index: client/civclient.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/civclient.h,v
retrieving revision 1.31
diff -u -u -r1.31 civclient.h
--- client/civclient.h 2003/11/28 17:37:19 1.31
+++ client/civclient.h 2003/12/01 19:24:25
@@ -62,5 +62,6 @@
void client_game_init(void);
void client_game_free(void);
+void ui_exit(void);
#endif /* FC__CIVCLIENT_H */
Index: client/gui-xaw/actions.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-xaw/actions.c,v
retrieving revision 1.17
diff -u -u -r1.17 actions.c
--- client/gui-xaw/actions.c 2003/07/23 13:46:03 1.17
+++ client/gui-xaw/actions.c 2003/12/01 19:24:26
@@ -596,7 +596,7 @@
static void xaw_msg_quit_freeciv(Widget w, XEvent *event, String *argv,
Cardinal *argc)
{
- main_quit_freeciv();
+ xaw_ui_exit();
}
/*******************************************************************************
Index: client/gui-xaw/connectdlg.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-xaw/connectdlg.c,v
retrieving revision 1.32
diff -u -u -r1.32 connectdlg.c
--- client/gui-xaw/connectdlg.c 2003/11/28 17:37:20 1.32
+++ client/gui-xaw/connectdlg.c 2003/12/01 19:24:26
@@ -237,10 +237,9 @@
/****************************************************************
...
*****************************************************************/
-void quit_callback(Widget w, XtPointer client_data,
- XtPointer call_data)
+void quit_callback(Widget w, XtPointer client_data, XtPointer call_data)
{
- exit(EXIT_SUCCESS);
+ xaw_ui_exit();
}
/****************************************************************
Index: client/gui-xaw/gui_main.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-xaw/gui_main.c,v
retrieving revision 1.83
diff -u -u -r1.83 gui_main.c
--- client/gui-xaw/gui_main.c 2003/08/06 07:34:38 1.83
+++ client/gui-xaw/gui_main.c 2003/12/01 19:24:27
@@ -685,9 +685,10 @@
/**************************************************************************
...
**************************************************************************/
-void main_quit_freeciv(void)
-{
- exit(EXIT_SUCCESS);
+void xaw_ui_exit(void)
+{
+ tilespec_free_tiles();
+ ui_exit();
}
/**************************************************************************
Index: client/gui-xaw/gui_main.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-xaw/gui_main.h,v
retrieving revision 1.10
diff -u -u -r1.10 gui_main.h
--- client/gui-xaw/gui_main.h 2003/07/23 13:46:03 1.10
+++ client/gui-xaw/gui_main.h 2003/12/01 19:24:27
@@ -17,7 +17,7 @@
#include "gui_main_g.h"
-void main_quit_freeciv(void);
+void xaw_ui_exit(void);
void main_show_info_popup(XEvent *event);
extern Atom wm_delete_window;
Index: client/gui-xaw/menu.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-xaw/menu.c,v
retrieving revision 1.57
diff -u -u -r1.57 menu.c
--- client/gui-xaw/menu.c 2003/09/15 16:05:35 1.57
+++ client/gui-xaw/menu.c 2003/12/01 19:24:27
@@ -39,6 +39,7 @@
#include "dialogs.h"
#include "finddlg.h"
#include "gotodlg.h"
+#include "gui_main.h"
#include "gui_stuff.h"
#include "helpdlg.h"
#include "mapctrl.h"
@@ -478,7 +479,7 @@
disconnect_from_server();
break;
case MENU_GAME_QUIT:
- exit(EXIT_SUCCESS);
+ xaw_ui_exit();
break;
}
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Freeciv-Dev] Re: (PR#6885) Remove memory leaks in xaw with quit_freeciv,
Raimar Falke <=
|
|