]> git.eshelyaron.com Git - emacs.git/commit
Fix NS crash on invalid frame title string (bug#42904)
authorMattias Engdegård <mattiase@acm.org>
Tue, 18 Aug 2020 10:58:12 +0000 (12:58 +0200)
committerMattias Engdegård <mattiase@acm.org>
Thu, 20 Aug 2020 17:39:14 +0000 (19:39 +0200)
commitbf60338d6dd02b4d848229878c8e14182f6f861f
treebbeb8e4a96460f3da3b8bc44fee10a3dc3be70c8
parent3b8a6ef18543cc56ed4524ac3d6a6843e818f6fb
Fix NS crash on invalid frame title string (bug#42904)

Instead of blindly assuming that all Emacs strings are valid UTF-8,
which they are not, use a more careful conversion going via UTF-16
which is what NSString uses internally.  Unpaired surrogates will
still go through to the NSString objects, but the NS libs handle them
gracefully.

* src/nsterm.h (EmacsString): New category.
* src/nsfns.m (all_nonzero_ascii): New helper function.
([NSString stringWithLispString:]): New method.
(ns_set_name_internal): Use new conversion method.
src/nsfns.m
src/nsterm.h