home *** CD-ROM | disk | FTP | other *** search
- To: vim-dev@vim.org
- Subject: patch 5.5.040
- Fcc: outbox
- From: Bram Moolenaar <Bram@moolenaar.net>
- ------------
-
- Patch 5.5.040
- Problem: Multi-byte: When there is some error in xim_real_init(), it can
- close XIM and return. After this there can be a segv.
- Solution: Test "xic" for being non-NULL, don't set "xim" to NULL. Also try
- to find more matches for supported styles. (Sung-Hyun Nam)
- Files: src/multbyte.c
-
-
- *** ../vim-5.5.39/src/multbyte.c Sun Oct 31 15:20:13 1999
- --- src/multbyte.c Wed Dec 1 18:21:21 1999
- ***************
- *** 189,195 ****
-
- static int xim_has_focus = 0;
- #ifdef USE_GUI_X11
- - static XIM xim;
- static XIMStyle input_style;
- static int status_area_enabled = TRUE;
- #endif
- --- 189,194 ----
- ***************
- *** 539,545 ****
-
- xim_real_init(x11_window, x11_display);
- gui_set_winsize(FALSE);
- ! if (xim != NULL)
- XUnregisterIMInstantiateCallback(x11_display, NULL, NULL, NULL,
- xim_instantiate_cb, NULL);
- }
- --- 538,544 ----
-
- xim_real_init(x11_window, x11_display);
- gui_set_winsize(FALSE);
- ! if (xic != NULL)
- XUnregisterIMInstantiateCallback(x11_display, NULL, NULL, NULL,
- xim_instantiate_cb, NULL);
- }
- ***************
- *** 556,562 ****
-
- gui_get_x11_windis(&x11_window, &x11_display);
-
- - xim = NULL;
- xic = NULL;
- status_area_enabled = FALSE;
-
- --- 555,560 ----
- ***************
- *** 575,581 ****
-
- gui_get_x11_windis(&x11_window, &x11_display);
-
- - xim = NULL;
- xic = NULL;
-
- if (xim_real_init(x11_window, x11_display))
- --- 573,578 ----
- ***************
- *** 601,606 ****
- --- 598,604 ----
- *end,
- tmp[1024],
- buf[32];
- + XIM xim = NULL;
- XIMStyles *xim_styles;
- XIMStyle this_input_style = 0;
- Boolean found;
- ***************
- *** 620,656 ****
- EMSG("XIM requires VIM compiled with +fontset feature.");
- return FALSE;
- #endif
- ! if (xim == NULL)
- {
- ! if (!gui.input_method || !*gui.input_method)
- ! {
- ! if ((p = XSetLocaleModifiers("")) != NULL && *p)
- ! xim = XOpenIM(x11_display, NULL, NULL, NULL);
- ! }
- ! else
- {
- ! strcpy(tmp, gui.input_method);
- ! for (ns = s = tmp; ns && *s;)
- ! {
- ! while (*s && isspace((unsigned char)*s))
- ! s++;
- ! if (!*s)
- ! break;
- ! if ((ns = end = strchr(s, ',')) == 0)
- ! end = s + strlen(s);
- ! while (isspace((unsigned char)*end))
- ! end--;
- ! *end = '\0';
- !
- ! strcpy(buf, "@im=");
- ! strcat(buf, s);
- ! if ((p = XSetLocaleModifiers(buf)) != NULL
- ! && *p
- ! && (xim = XOpenIM(x11_display, NULL, NULL, NULL)) != NULL)
- ! break;
-
- ! s = ns + 1;
- ! }
- }
- }
-
- --- 618,655 ----
- EMSG("XIM requires VIM compiled with +fontset feature.");
- return FALSE;
- #endif
- !
- ! if (xic != NULL)
- ! return FALSE;
- !
- ! if (!gui.input_method || !*gui.input_method)
- {
- ! if ((p = XSetLocaleModifiers("")) != NULL && *p)
- ! xim = XOpenIM(x11_display, NULL, NULL, NULL);
- ! }
- ! else
- ! {
- ! strcpy(tmp, gui.input_method);
- ! for (ns = s = tmp; ns && *s;)
- {
- ! while (*s && isspace((unsigned char)*s))
- ! s++;
- ! if (!*s)
- ! break;
- ! if ((ns = end = strchr(s, ',')) == 0)
- ! end = s + strlen(s);
- ! while (isspace((unsigned char)*end))
- ! end--;
- ! *end = '\0';
- !
- ! strcpy(buf, "@im=");
- ! strcat(buf, s);
- ! if ((p = XSetLocaleModifiers(buf)) != NULL
- ! && *p
- ! && (xim = XOpenIM(x11_display, NULL, NULL, NULL)) != NULL)
- ! break;
-
- ! s = ns + 1;
- }
- }
-
- ***************
- *** 711,716 ****
- --- 710,722 ----
- {
- if (this_input_style == xim_styles->supported_styles[i])
- {
- + found = True;
- + break;
- + }
- + if ((xim_styles->supported_styles[i] & this_input_style)
- + == (this_input_style & ~XIMStatusArea))
- + {
- + this_input_style &= ~XIMStatusArea;
- found = True;
- break;
- }
- *** ../vim-5.5.39/src/version.c Wed Dec 1 20:19:07 1999
- --- src/version.c Wed Dec 1 18:29:17 1999
- ***************
- *** 420,420 ****
- --- 420,421 ----
- { /* Add new patch number below this line */
- + 40,
-
- --
- hundred-and-one symptoms of being an internet addict:
- 158. You get a tuner card so you can watch TV while surfing.
-
- --/-/---- Bram Moolenaar ---- Bram@moolenaar.net ---- Bram@vim.org ---\-\--
- \ \ www.vim.org/iccf www.moolenaar.net www.vim.org / /
-