changeset 106820:1f555410c9c7

Fix gc bug in terminal allocation. * xterm.c (x_term_init): Avoid garbage-collecting the new terminal during call to vendor-specific-keysyms (Bug#5365).
author Chong Yidong <cyd@stupidchicken.com>
date Wed, 13 Jan 2010 13:35:36 -0500
parents 328951014a28
children 203a882ff4c0 91a0123d1993
files src/ChangeLog src/xterm.c
diffstat 2 files changed, 9 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Wed Jan 13 17:28:32 2010 +0100
+++ b/src/ChangeLog	Wed Jan 13 13:35:36 2010 -0500
@@ -1,3 +1,8 @@
+2010-01-13  Chong Yidong  <cyd@stupidchicken.com>
+
+	* xterm.c (x_term_init): Avoid garbage-collecting the new terminal
+	during call to vendor-specific-keysyms (Bug#5365).
+
 2010-01-13  YAMAMOTO Mitsuharu  <mituharu@math.s.chiba-u.ac.jp>
 
 	* keyboard.c (input_available_signal) [SYNC_INPUT]:
--- a/src/xterm.c	Wed Jan 13 17:28:32 2010 +0100
+++ b/src/xterm.c	Wed Jan 13 13:35:36 2010 -0500
@@ -10218,13 +10218,16 @@
 	if (!EQ (XSYMBOL (Qvendor_specific_keysyms)->function, Qunbound))
 	  {
 	    char *vendor = ServerVendor (dpy);
-	    /* Temporarily hide the partially initialized terminal */
+	    /* Temporarily hide the partially initialized terminal,
+	       but make sure it doesn't get garbage collected.  */
+	    int count = inhibit_garbage_collection ();
 	    terminal_list = terminal->next_terminal;
 	    UNBLOCK_INPUT;
 	    terminal->kboard->Vsystem_key_alist
 	      = call1 (Qvendor_specific_keysyms,
 		       vendor ? build_string (vendor) : empty_unibyte_string);
 	    BLOCK_INPUT;
+	    unbind_to (count, Qnil);
 	    terminal->next_terminal = terminal_list;
  	    terminal_list = terminal;
 	  }