emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r99341: (x_term_init): Instead of inh


From: Stefan Monnier
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r99341: (x_term_init): Instead of inhibiting GC while running Lisp
Date: Fri, 15 Jan 2010 23:49:37 -0500
User-agent: Bazaar (2.0.2)

------------------------------------------------------------
revno: 99341
committer: Stefan Monnier <address@hidden>
branch nick: trunk
timestamp: Fri 2010-01-15 23:49:37 -0500
message:
  (x_term_init): Instead of inhibiting GC while running Lisp
  code, link the new kboard into all_kboard before running Lisp code,
  and protect the new terminal with GCPRO (Bug#5365).
  (x_term_init): Remove unused var `atom'.
  (x_delete_display, x_delete_terminal): Remove unused var `i'.
modified:
  src/ChangeLog
  src/xterm.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2010-01-15 17:04:14 +0000
+++ b/src/ChangeLog     2010-01-16 04:49:37 +0000
@@ -1,3 +1,11 @@
+2010-01-16  Stefan Monnier  <address@hidden>
+
+       * xterm.c (x_term_init): Instead of inhibiting GC while running Lisp
+       code, link the new kboard into all_kboard before running Lisp code,
+       and protect the new terminal with GCPRO (Bug#5365).
+       (x_term_init): Remove unused var `atom'.
+       (x_delete_display, x_delete_terminal): Remove unused var `i'.
+
 2010-01-15  Jan Djärv  <address@hidden>
 
        * xfns.c (x_get_current_desktop, x_get_desktop_workarea): New functions.

=== modified file 'src/xterm.c'
--- a/src/xterm.c       2010-01-13 18:35:36 +0000
+++ b/src/xterm.c       2010-01-16 04:49:37 +0000
@@ -9821,7 +9821,7 @@
 {
   Pixmap icon_pixmap, icon_mask;
 
-#ifndef USE_X_TOOLKIT
+#if !defined USE_X_TOOLKIT && !defined USE_GTK
   Window window = FRAME_OUTER_WINDOW (f);
 #endif
 
@@ -10076,7 +10076,6 @@
     int argc;
     char *argv[NUM_ARGV];
     char **argv2 = argv;
-    GdkAtom atom;
     guint id;
 #ifndef HAVE_GTK_MULTIDISPLAY
     if (!EQ (Vinitial_window_system, Qx))
@@ -10215,25 +10214,36 @@
        terminal->kboard = (KBOARD *) xmalloc (sizeof (KBOARD));
        init_kboard (terminal->kboard);
        terminal->kboard->Vwindow_system = Qx;
+
+       /* Add the keyboard to the list before running Lisp code (via
+           Qvendor_specific_keysyms below), since these are not traced
+           via terminals but only through all_kboards.  */
+       terminal->kboard->next_kboard = all_kboards;
+       all_kboards = terminal->kboard;
+
        if (!EQ (XSYMBOL (Qvendor_specific_keysyms)->function, Qunbound))
          {
            char *vendor = ServerVendor (dpy);
-           /* Temporarily hide the partially initialized terminal,
-              but make sure it doesn't get garbage collected.  */
-           int count = inhibit_garbage_collection ();
+
+           /* Protect terminal from GC before removing it from the
+              list of terminals.  */
+           struct gcpro gcpro1;
+           Lisp_Object gcpro_term;
+           XSETTERMINAL (gcpro_term, terminal);
+           GCPRO1 (gcpro_term);
+
+           /* Temporarily hide the partially initialized terminal.  */
            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;
+           UNGCPRO;
          }
 
-       terminal->kboard->next_kboard = all_kboards;
-       all_kboards = terminal->kboard;
        /* Don't let the initial kboard remain current longer than necessary.
           That would cause problems if a file loaded on startup tries to
           prompt in the mini-buffer.  */
@@ -10582,7 +10592,6 @@
 x_delete_display (dpyinfo)
      struct x_display_info *dpyinfo;
 {
-  int i;
   struct terminal *t;
 
   /* Close all frames and delete the generic struct terminal for this
@@ -10734,7 +10743,6 @@
 x_delete_terminal (struct terminal *terminal)
 {
   struct x_display_info *dpyinfo = terminal->display_info.x;
-  int i;
 
   /* Protect against recursive calls.  delete_frame in
      delete_terminal calls us back when it deletes our last frame.  */


reply via email to

[Prev in Thread] Current Thread [Next in Thread]