aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDmitry Antipov2014-03-06 15:18:22 +0400
committerDmitry Antipov2014-03-06 15:18:22 +0400
commit12e852a208f2035094b46999e92afa8e3366748b (patch)
tree4843fd877d76169e571bb18ce4b43a812601ba34 /src
parentf65ba1005b499a7fb77c77652f37338277f06616 (diff)
downloademacs-12e852a208f2035094b46999e92afa8e3366748b.tar.gz
emacs-12e852a208f2035094b46999e92afa8e3366748b.zip
* xterm.c (xim_initialize): Always pass a copy of resource name
to XRegisterIMInstantiateCallback and eassert whether return value is True. Passing copy is important because Xlib doesn't make its own copy and resource name argument usually points to SSDATA (Vx_resource_name), which may be changed from Lisp. (xim_close_display): For XUnregisterIMInstantiateCallback, always eassert return value and pass exactly the same values as were used for XRegisterIMInstantiateCallback. Otherwise XUnregisterIMInstantiateCallback will always fail. See Xlib sources to check why if you are interested.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog13
-rw-r--r--src/xterm.c31
2 files changed, 32 insertions, 12 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 29b6078b037..8f9d7f555a3 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,16 @@
12014-03-06 Dmitry Antipov <dmantipov@yandex.ru>
2
3 * xterm.c (xim_initialize): Always pass a copy of resource name
4 to XRegisterIMInstantiateCallback and eassert whether return
5 value is True. Passing copy is important because Xlib doesn't
6 make its own copy and resource name argument usually points to
7 SSDATA (Vx_resource_name), which may be changed from Lisp.
8 (xim_close_display): For XUnregisterIMInstantiateCallback,
9 always eassert return value and pass exactly the same values
10 as were used for XRegisterIMInstantiateCallback. Otherwise
11 XUnregisterIMInstantiateCallback will always fail. See Xlib
12 sources to check why if you are interested.
13
12014-03-05 Martin Rudalics <rudalics@gmx.at> 142014-03-05 Martin Rudalics <rudalics@gmx.at>
2 15
3 * dispnew.c (change_frame_size_1): Add new_lines instead of 16 * dispnew.c (change_frame_size_1): Add new_lines instead of
diff --git a/src/xterm.c b/src/xterm.c
index 71b5126f340..bf5456b5f8b 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -7955,17 +7955,18 @@ xim_initialize (struct x_display_info *dpyinfo, char *resource_name)
7955 { 7955 {
7956#ifdef HAVE_X11R6_XIM 7956#ifdef HAVE_X11R6_XIM
7957 struct xim_inst_t *xim_inst = xmalloc (sizeof *xim_inst); 7957 struct xim_inst_t *xim_inst = xmalloc (sizeof *xim_inst);
7958 Bool ret;
7958 7959
7959 dpyinfo->xim_callback_data = xim_inst; 7960 dpyinfo->xim_callback_data = xim_inst;
7960 xim_inst->dpyinfo = dpyinfo; 7961 xim_inst->dpyinfo = dpyinfo;
7961 xim_inst->resource_name = xstrdup (resource_name); 7962 xim_inst->resource_name = xstrdup (resource_name);
7962 XRegisterIMInstantiateCallback (dpyinfo->display, dpyinfo->xrdb, 7963 ret = XRegisterIMInstantiateCallback
7963 resource_name, emacs_class, 7964 (dpyinfo->display, dpyinfo->xrdb, xim_inst->resource_name,
7964 xim_instantiate_callback, 7965 emacs_class, xim_instantiate_callback,
7965 /* This is XPointer in XFree86 7966 /* This is XPointer in XFree86 but (XPointer *)
7966 but (XPointer *) on Tru64, at 7967 on Tru64, at least, hence the configure test. */
7967 least, hence the configure test. */ 7968 (XRegisterIMInstantiateCallback_arg6) xim_inst);
7968 (XRegisterIMInstantiateCallback_arg6) xim_inst); 7969 eassert (ret == True);
7969#else /* not HAVE_X11R6_XIM */ 7970#else /* not HAVE_X11R6_XIM */
7970 xim_open_dpy (dpyinfo, resource_name); 7971 xim_open_dpy (dpyinfo, resource_name);
7971#endif /* not HAVE_X11R6_XIM */ 7972#endif /* not HAVE_X11R6_XIM */
@@ -7983,12 +7984,18 @@ xim_close_dpy (struct x_display_info *dpyinfo)
7983 if (use_xim) 7984 if (use_xim)
7984 { 7985 {
7985#ifdef HAVE_X11R6_XIM 7986#ifdef HAVE_X11R6_XIM
7987 struct xim_inst_t *xim_inst = dpyinfo->xim_callback_data;
7988
7986 if (dpyinfo->display) 7989 if (dpyinfo->display)
7987 XUnregisterIMInstantiateCallback (dpyinfo->display, dpyinfo->xrdb, 7990 {
7988 NULL, emacs_class, 7991 Bool ret = XUnregisterIMInstantiateCallback
7989 xim_instantiate_callback, NULL); 7992 (dpyinfo->display, dpyinfo->xrdb, xim_inst->resource_name,
7990 xfree (dpyinfo->xim_callback_data->resource_name); 7993 emacs_class, xim_instantiate_callback,
7991 xfree (dpyinfo->xim_callback_data); 7994 (XRegisterIMInstantiateCallback_arg6) xim_inst);
7995 eassert (ret == True);
7996 }
7997 xfree (xim_inst->resource_name);
7998 xfree (xim_inst);
7992#endif /* HAVE_X11R6_XIM */ 7999#endif /* HAVE_X11R6_XIM */
7993 if (dpyinfo->display) 8000 if (dpyinfo->display)
7994 XCloseIM (dpyinfo->xim); 8001 XCloseIM (dpyinfo->xim);