aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/term.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/term.c b/src/term.c
index e15b7a0887e..32f3c8c48d6 100644
--- a/src/term.c
+++ b/src/term.c
@@ -184,9 +184,15 @@ tty_send_additional_strings (struct terminal *terminal, Lisp_Object sym)
184 Lisp_Object string = XCAR (extra_codes); 184 Lisp_Object string = XCAR (extra_codes);
185 if (STRINGP (string)) 185 if (STRINGP (string))
186 { 186 {
187 fwrite (SDATA (string), 1, SBYTES (string), tty->output); 187 struct Lisp_String *str = XSTRING (string);
188 /* Don't use SBYTES, as that is not protected from GC. */
189 ptrdiff_t sbytes
190 = (str->u.s.size_byte < 0
191 ? str->u.s.size & ~ARRAY_MARK_FLAG
192 : str->u.s.size_byte);
193 fwrite (SDATA (string), 1, sbytes, tty->output);
188 if (tty->termscript) 194 if (tty->termscript)
189 fwrite (SDATA (string), 1, SBYTES (string), tty->termscript); 195 fwrite (SDATA (string), 1, sbytes, tty->termscript);
190 } 196 }
191 } 197 }
192} 198}