Mercurial > vim
diff src/ui.c @ 5037:5e0b6a9282df v7.3.1262
updated for version 7.3.1262
Problem: Crash and compilation warnings with Cygwin.
Solution: Check return value of XmbTextListToTextProperty(). Add type casts.
Adjust #ifdefs. (Lech Lorens)
author | Bram Moolenaar <bram@vim.org> |
---|---|
date | Sat, 29 Jun 2013 14:17:02 +0200 |
parents | 902d6ab377ee |
children | c3a82208e143 |
line wrap: on
line diff
--- a/src/ui.c +++ b/src/ui.c @@ -2366,14 +2366,20 @@ clip_x11_convert_selection_cb(w, sel_ato { XTextProperty text_prop; char *string_nt = (char *)alloc((unsigned)*length + 1); + int conv_result; /* create NUL terminated string which XmbTextListToTextProperty wants */ mch_memmove(string_nt, string, (size_t)*length); string_nt[*length] = NUL; - XmbTextListToTextProperty(X_DISPLAY, (char **)&string_nt, 1, - XCompoundTextStyle, &text_prop); + conv_result = XmbTextListToTextProperty(X_DISPLAY, (char **)&string_nt, + 1, XCompoundTextStyle, &text_prop); vim_free(string_nt); XtFree(*value); /* replace with COMPOUND text */ + if (conv_result != Success) + { + vim_free(string); + return False; + } *value = (XtPointer)(text_prop.value); /* from plain text */ *length = text_prop.nitems; *type = compound_text_atom;