emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] emacs-24 r117423: Fix bug with an attempt to select uninit


From: Dmitry Antipov
Subject: [Emacs-diffs] emacs-24 r117423: Fix bug with an attempt to select uninitialized frame (Bug#18161).
Date: Sun, 03 Aug 2014 07:21:46 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 117423
revision-id: address@hidden
parent: address@hidden
committer: Dmitry Antipov <address@hidden>
branch nick: emacs-24
timestamp: Sun 2014-08-03 11:19:43 +0400
message:
  Fix bug with an attempt to select uninitialized frame (Bug#18161).
  * xfns.c (Fx_create_frame): Move call to change_frame_size to
  a section where Lisp evaluation is disabled.  This way a pointer
  to uninitialized frame is not accessible from Lisp, which becomes
  critical if following call to x_figure_window_size throws an error.
modified:
  src/ChangeLog                  changelog-20091113204419-o5vbwnq5f7feedwu-1438
  src/xfns.c                     xfns.c-20091113204419-o5vbwnq5f7feedwu-274
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2014-08-02 22:58:09 +0000
+++ b/src/ChangeLog     2014-08-03 07:19:43 +0000
@@ -1,3 +1,11 @@
+2014-08-03  Dmitry Antipov  <address@hidden>
+
+       Fix bug with an attempt to select uninitialized frame (Bug#18161).
+       * xfns.c (Fx_create_frame): Move call to change_frame_size to
+       a section where Lisp evaluation is disabled.  This way a pointer
+       to uninitialized frame is not accessible from Lisp, which becomes
+       critical if following call to x_figure_window_size throws an error.
+
 2014-08-02  Paul Eggert  <address@hidden>
 
        Fix bug with clang + directory_files_internal + GC (Bug#16986).

=== modified file 'src/xfns.c'
--- a/src/xfns.c        2014-07-12 09:25:29 +0000
+++ b/src/xfns.c        2014-08-03 07:19:43 +0000
@@ -2884,7 +2884,7 @@
   int minibuffer_only = 0;
   long window_prompting = 0;
   int width, height;
-  ptrdiff_t count = SPECPDL_INDEX ();
+  ptrdiff_t count = SPECPDL_INDEX (), count2;
   struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
   Lisp_Object display;
   struct x_display_info *dpyinfo = NULL;
@@ -3130,6 +3130,14 @@
      end up in init_iterator with a null face cache, which should not
      happen.  */
   init_frame_faces (f);
+  
+  /* Temporary disable window-configuration-change-hook to avoid
+     an infloop in next_frame and access to uninitialized frame
+     from Lisp code (Bug#18161).  */
+
+  count2 = SPECPDL_INDEX ();
+  record_unwind_protect (unwind_create_frame_1, inhibit_lisp_code);
+  inhibit_lisp_code = Qt;
 
   /* PXW: This is a duplicate from below.  We have to do it here since
      otherwise x_set_tool_bar_lines will work with the character sizes
@@ -3145,27 +3153,18 @@
   /* Set the menu-bar-lines and tool-bar-lines parameters.  We don't
      look up the X resources controlling the menu-bar and tool-bar
      here; they are processed specially at startup, and reflected in
-     the values of the mode variables.
-
-     Avoid calling window-configuration-change-hook; otherwise we
-     could get an infloop in next_frame since the frame is not yet in
-     Vframe_list.  */
-  {
-    ptrdiff_t count2 = SPECPDL_INDEX ();
-    record_unwind_protect (unwind_create_frame_1, inhibit_lisp_code);
-    inhibit_lisp_code = Qt;
-
-    x_default_parameter (f, parms, Qmenu_bar_lines,
-                        NILP (Vmenu_bar_mode)
-                        ? make_number (0) : make_number (1),
-                        NULL, NULL, RES_TYPE_NUMBER);
-    x_default_parameter (f, parms, Qtool_bar_lines,
-                        NILP (Vtool_bar_mode)
-                        ? make_number (0) : make_number (1),
-                        NULL, NULL, RES_TYPE_NUMBER);
-
-    unbind_to (count2, Qnil);
-  }
+     the values of the mode variables.  */
+
+  x_default_parameter (f, parms, Qmenu_bar_lines,
+                      NILP (Vmenu_bar_mode)
+                      ? make_number (0) : make_number (1),
+                      NULL, NULL, RES_TYPE_NUMBER);
+  x_default_parameter (f, parms, Qtool_bar_lines,
+                      NILP (Vtool_bar_mode)
+                      ? make_number (0) : make_number (1),
+                      NULL, NULL, RES_TYPE_NUMBER);
+
+  unbind_to (count2, Qnil);
 
   x_default_parameter (f, parms, Qbuffer_predicate, Qnil,
                       "bufferPredicate", "BufferPredicate",


reply via email to

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