diff options
author | YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> | 2009-05-19 00:27:03 +0000 |
---|---|---|
committer | YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> | 2009-05-19 00:27:03 +0000 |
commit | 1c6d1051f17696737000032498c108cf9d0fd114 (patch) | |
tree | 5937028f49bc62f6bf1df18f50b4c213151909c2 | |
parent | 5858bcc49bd1ea9f7c944e150133fe4f11995098 (diff) | |
download | emacs-1c6d1051f17696737000032498c108cf9d0fd114.tar.gz |
(x_delete_display): Don't call XrmDestroyDatabase here.
(x_delete_terminal): Dissociate resource database from display and
then call XrmDestroyDatabase before closing display.
-rw-r--r-- | src/ChangeLog | 6 | ||||
-rw-r--r-- | src/xterm.c | 21 |
2 files changed, 20 insertions, 7 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 2518a8da077..4645317e94b 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2009-05-19 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> + + * xterm.c (x_delete_display): Don't call XrmDestroyDatabase here. + (x_delete_terminal): Dissociate resource database from display and + then call XrmDestroyDatabase before closing display. + 2009-05-18 Adrian Robert <Adrian.B.Robert@gmail.com> * nsterm.m (ns_read_socket): Remove unused variable. diff --git a/src/xterm.c b/src/xterm.c index f12250085ee..ec6c4d4011f 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -10613,13 +10613,6 @@ x_delete_display (dpyinfo) tail->next = tail->next->next; } - /* Xt and GTK do this themselves. */ -#if ! defined (USE_X_TOOLKIT) && ! defined (USE_GTK) -#ifndef AIX /* On AIX, XCloseDisplay calls this. */ - XrmDestroyDatabase (dpyinfo->xrdb); -#endif -#endif - xfree (dpyinfo->x_id_name); xfree (dpyinfo->x_dnd_atoms); xfree (dpyinfo->color_cells); @@ -10740,6 +10733,20 @@ x_delete_terminal (struct terminal *terminal) x_destroy_all_bitmaps (dpyinfo); XSetCloseDownMode (dpyinfo->display, DestroyAll); + /* Whether or not XCloseDisplay destroys the associated resource + database depends on the version of libX11. To avoid both + crash and memory leak, we dissociate the database from the + display and then destroy dpyinfo->xrdb ourselves. */ +#ifdef HAVE_XRMSETDATABASE + XrmSetDatabase (dpyinfo->display, NULL); +#else + dpyinfo->display->db = NULL; +#endif + /* We used to call XrmDestroyDatabase from x_delete_display, but + some older versions of libX11 crash if we call it after + closing all the displays. */ + XrmDestroyDatabase (dpyinfo->xrdb); + #ifdef USE_GTK xg_display_close (dpyinfo->display); #else |