From: David Smith <davidsmith@acm.org>
To: emacs-devel@gnu.org
Subject: segfault when using XIM with multi-tty on gnu/linux
Date: Thu, 14 Aug 2008 01:37:15 +0900 [thread overview]
Message-ID: <87hc9oq3b8.fsf@piyo.tok.corp.google.com> (raw)
[-- Attachment #1.1: Type: text/plain, Size: 2423 bytes --]
This is with git commit 36d10c7d (Aug 13, 2008).
Steps to reproduce:
1. start emacs -nw
2. have XIM active for your X session (run scim -d)
3. start X11-capable emacs frame with emacsclient -c
4. close the X11 emacs frame
5. segfault with error
*** glibc detected *** /usr/bin/emacs: corrupted double-linked list: 0x083afdf0 ***
Backtrace:
#0 0xb78575c0 in _XSend () from /usr/lib/libX11.so.6
#1 0xb7857792 in _XFlush () from /usr/lib/libX11.so.6
#2 0xb7830a91 in XFlush () from /usr/lib/libX11.so.6
#3 0xb7882160 in ?? () from /usr/lib/libX11.so.6
#4 0xb78818d2 in _XimFlush () from /usr/lib/libX11.so.6
#5 0xb7872618 in ?? () from /usr/lib/libX11.so.6
#6 0xb785d134 in XCloseIM () from /usr/lib/libX11.so.6
#7 0x080d34ed in x_delete_display (dpyinfo=0x942dba0) at xterm.c:8315
#8 0x080d35ea in x_delete_terminal (terminal=0x942dd58) at xterm.c:10650
#9 0x080ca538 in Fdelete_terminal (terminal=155376988, force=137841993) at terminal.c:334
#10 0x08063e0f in Fdelete_frame (frame=155892172, force=137841993) at frame.c:1512
#11 0x08180d4d in Ffuncall (nargs=1, args=0xbf808ee0) at eval.c:3045
#12 0x0817de71 in Fcall_interactively (function=137877289, record_flag=137841945, keys=137880348) at callint.c:857
#13 0x08180d34 in Ffuncall (nargs=4, args=0xbf809090) at eval.c:3048
#14 0x08180e89 in call3 (fn=138006169, arg1=137877289, arg2=137841945, arg3=137841945) at eval.c:2872
#15 0x0812743e in command_loop_1 () at keyboard.c:1879
#16 0x0817f5d0 in internal_condition_case (bfun=0x81270e0 <command_loop_1>, handlers=137885153,
hfun=0x8122060 <cmd_error>) at eval.c:1511
#17 0x08121473 in command_loop_2 () at keyboard.c:1338
#18 0x0817f6aa in internal_catch (tag=137881129, func=0x8121450 <command_loop_2>, arg=137841945) at eval.c:1247
#19 0x08121ec7 in command_loop () at keyboard.c:1317
#20 0x0812223b in recursive_edit_1 () at keyboard.c:942
#21 0x08122371 in Frecursive_edit () at keyboard.c:1004
#22 0x08116ffc in main (argc=2, argv=0xbf809744) at emacs.c:1689
Analysis:
Is the call to XCloseIM() in xim_close_dpy (xterm.c:8316) necessary?
Since if we HAVE_X11R6_XIM, xim_destroy_callback is called, and it
claims there is no need to call XCloseIM (xterm.c:8143). A small patch
is attached that changes the logic of xim_close_dpy slightly to call
XCloseIM iff HAVE_XIM && !HAVE_X11R6_XIM. This fixes the segfault here.
Cheers,
- dds
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: prevent double free segfault when using XIM and multi-tty --]
[-- Type: text/x-diff, Size: 1015 bytes --]
From 2bf89dbf20821870c55040187593aa6e07dda844 Mon Sep 17 00:00:00 2001
From: David Smith <dds@google.com>
Date: Thu, 14 Aug 2008 01:21:27 +0900
Subject: [PATCH] Prevent double-free segfault when using XIM and multi-tty. When
HAVE_X11R6_XIM is defined, let xim_destroy_callback, there is no need to
call XCloseIM.
---
src/xterm.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/src/xterm.c b/src/xterm.c
index a32f4e1..ed982b8 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -8310,9 +8310,11 @@ xim_close_dpy (dpyinfo)
XUnregisterIMInstantiateCallback (dpyinfo->display, dpyinfo->xrdb,
NULL, EMACS_CLASS,
xim_instantiate_callback, NULL);
-#endif /* not HAVE_X11R6_XIM */
+#else /* not HAVE_X11R6_XIM */
+ /* if we have X11R6 xim, this causes a double-free */
if (dpyinfo->display)
XCloseIM (dpyinfo->xim);
+#endif /* not HAVE_X11R6_XIM */
dpyinfo->xim = NULL;
XFree (dpyinfo->xim_styles);
}
--
1.5.4.3
[-- Attachment #2: Type: application/pgp-signature, Size: 480 bytes --]
next reply other threads:[~2008-08-13 16:37 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-13 16:37 David Smith [this message]
-- strict thread matches above, loose matches on Subject: below --
2008-12-13 5:55 segfault when using XIM with multi-tty on gnu/linux Chong Yidong
2008-12-13 11:03 ` Zsitvai János
2008-12-13 14:46 ` Chong Yidong
2008-12-13 17:18 ` Zsitvai János
2008-12-13 17:31 ` Chong Yidong
2008-12-13 17:48 ` Zsitvai János
2008-12-13 22:11 ` Chong Yidong
2008-12-14 4:08 ` Zsitvai János
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87hc9oq3b8.fsf@piyo.tok.corp.google.com \
--to=davidsmith@acm.org \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.