İsmail Dönmez | 19 Aug 12:18
Gravatar

[PATCH] XCloseDisplay already calls XrmDestroyDatabase

Hi,

Running on Ubuntu's upcoming Intrepid release I experienced X crashes
when I quit emacsclient. The gdb log shows XrmDestroyDatabase() is the
failing line. Looking at

src/xterm.c lines around about 10514:

#ifndef USE_X_TOOLKIT   /* I'm told Xt does this itself.  */
#ifndef AIX            /* On AIX, XCloseDisplay calls this.  */
  XrmDestroyDatabase (dpyinfo->xrdb);
#endif
#endif

So this code assumes only on AIX XCloseDisplay itself calls
XrmDestroyDatabase but this doesn't seem to be the case, looking at
libX11 1.1.4 source code,

src/OpenDis.c starting line 832:

    822     /* if RM database was allocated by XGetDefault() free it */
    823     if (dpy->db && (dpy->flags & XlibDisplayDfltRMDB))
    824         XrmDestroyDatabase(dpy->db);

this is from the _XFreeDisplayStructure() function and the function
documentation says:

 /* XFreeDisplayStructure frees all the storage associated with a
  * Display.  It is used by XOpenDisplay if it runs out of memory,
  * and also by XCloseDisplay.
....
*/

So looks like there is no need to manually call XrmDestroyDatabase()
anymore, attached patch removes it.

Regards,
ismail

--

-- 
Programmer Excuse #4: It's too complicated for you to understand.
Attachment (xrm.patch): text/x-diff, 444 bytes

Gmane