# HG changeset patch # User Chong Yidong # Date 1229147078 0 # Node ID 6a2e1b91fbd1afbb73c76c3e50f4af2dc26674ce # Parent 5a21f5d2ef2477ab87bac41e2b6156b223ef0f52 (struct xim_inst_t): Definition moved to xterm.h. (xim_initialize): Save pointer to callback function data. (xim_close_dpy): Free callback function data. Call XCloseIM, reverting 2008-11-04 change by David Smith. (x_term_init): Don't initialize the image cache here; it will be done in init_frame_faces. Remove ancient "null_pixel" cruft. (x_delete_display): Free x_dnd_atoms member. diff -r 5a21f5d2ef24 -r 6a2e1b91fbd1 src/xterm.c --- a/src/xterm.c Sat Dec 13 05:41:55 2008 +0000 +++ b/src/xterm.c Sat Dec 13 05:44:38 2008 +0000 @@ -8184,6 +8184,8 @@ #ifdef HAVE_XIM if (use_xim) { + if (dpyinfo->xim) + XCloseIM (dpyinfo->xim); xim = XOpenIM (dpyinfo->display, dpyinfo->xrdb, resource_name, EMACS_CLASS); dpyinfo->xim = xim; @@ -8213,12 +8215,6 @@ #ifdef HAVE_X11R6_XIM -struct xim_inst_t -{ - struct x_display_info *dpyinfo; - char *resource_name; -}; - /* XIM instantiate callback function, which is called whenever an XIM server is available. DISPLAY is the display of the XIM. CLIENT_DATA contains a pointer to an xim_inst_t structure created @@ -8282,6 +8278,7 @@ struct x_display_info *dpyinfo; char *resource_name; { + dpyinfo->xim = NULL; #ifdef HAVE_XIM if (use_xim) { @@ -8289,8 +8286,8 @@ struct xim_inst_t *xim_inst; int len; - dpyinfo->xim = NULL; xim_inst = (struct xim_inst_t *) xmalloc (sizeof (struct xim_inst_t)); + dpyinfo->xim_callback_data = xim_inst; xim_inst->dpyinfo = dpyinfo; len = strlen (resource_name); xim_inst->resource_name = (char *) xmalloc (len + 1); @@ -8303,14 +8300,10 @@ least, hence the configure test. */ (XRegisterIMInstantiateCallback_arg6) xim_inst); #else /* not HAVE_X11R6_XIM */ - dpyinfo->xim = NULL; xim_open_dpy (dpyinfo, resource_name); #endif /* not HAVE_X11R6_XIM */ - - } - else + } #endif /* HAVE_XIM */ - dpyinfo->xim = NULL; } @@ -8328,11 +8321,11 @@ XUnregisterIMInstantiateCallback (dpyinfo->display, dpyinfo->xrdb, NULL, EMACS_CLASS, xim_instantiate_callback, NULL); -#else /* not HAVE_X11R6_XIM */ - /* If we have X11R6 xim, this causes a double-free. */ + xfree (dpyinfo->xim_callback_data->resource_name); + xfree (dpyinfo->xim_callback_data); +#endif /* HAVE_X11R6_XIM */ if (dpyinfo->display) XCloseIM (dpyinfo->xim); -#endif /* HAVE_X11R6_XIM */ dpyinfo->xim = NULL; XFree (dpyinfo->xim_styles); } @@ -10242,7 +10235,6 @@ dpyinfo->x_focus_frame = 0; dpyinfo->x_focus_event_frame = 0; dpyinfo->x_highlight_frame = 0; - dpyinfo->terminal->image_cache = make_image_cache (); dpyinfo->wm_type = X_WMTYPE_UNKNOWN; /* See if we can construct pixel values from RGB values. */ @@ -10370,17 +10362,6 @@ dpyinfo->connection = connection; { - char null_bits[1]; - - null_bits[0] = 0x00; - - dpyinfo->null_pixel - = XCreatePixmapFromBitmapData (dpyinfo->display, dpyinfo->root_window, - null_bits, 1, 1, (long) 0, (long) 0, - 1); - } - - { extern int gray_bitmap_width, gray_bitmap_height; extern char *gray_bitmap_bits; dpyinfo->gray @@ -10549,6 +10530,7 @@ #endif xfree (dpyinfo->x_id_name); + xfree (dpyinfo->x_dnd_atoms); xfree (dpyinfo->color_cells); xfree (dpyinfo); }