emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] emacs/src xterm.c


From: YAMAMOTO Mitsuharu
Subject: [Emacs-diffs] emacs/src xterm.c
Date: Tue, 19 May 2009 00:26:47 +0000

CVSROOT:        /cvsroot/emacs
Module name:    emacs
Changes by:     YAMAMOTO Mitsuharu <mituharu>   09/05/19 00:26:47

Modified files:
        src            : xterm.c 

Log message:
        (x_delete_display): Don't call XrmDestroyDatabase here.
        (x_delete_terminal): Dissociate resource database from display and
        then call XrmDestroyDatabase before closing display.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/emacs/src/xterm.c?cvsroot=emacs&r1=1.1025&r2=1.1026

Patches:
Index: xterm.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/xterm.c,v
retrieving revision 1.1025
retrieving revision 1.1026
diff -u -b -r1.1025 -r1.1026
--- xterm.c     2 May 2009 20:16:58 -0000       1.1025
+++ xterm.c     19 May 2009 00:26:46 -0000      1.1026
@@ -10613,13 +10613,6 @@
          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_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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]