summaryrefslogtreecommitdiff
path: root/src/xfns.c
diff options
context:
space:
mode:
authorChong Yidong <cyd@gnu.org>2012-02-23 15:28:21 +0800
committerChong Yidong <cyd@gnu.org>2012-02-23 15:28:21 +0800
commitf01d3321d5a7ca4147b675f02d5aa51dc65c2b55 (patch)
treed300ae3022865077969c1a27c539a4bd7bf59381 /src/xfns.c
parent8f4042d244cc9dd4eb05ec9756020fd03ca36eab (diff)
downloademacs-f01d3321d5a7ca4147b675f02d5aa51dc65c2b55.tar.gz
Avoid infloop in next-frame during frame creation.
See thread at http://lists.gnu.org/archive/html/emacs-devel/2012-02/msg00573.html * src/window.c (inhibit_window_configuration_change_hook): New var. (run_window_configuration_change_hook): Obey it. * src/xfns.c (Fx_create_frame): Avoid window-configuration-change-hook call when setting menu-bar-lines and tool-bar-lines parameters. (unwind_create_frame_1): New helper function.
Diffstat (limited to 'src/xfns.c')
-rw-r--r--src/xfns.c42
1 files changed, 31 insertions, 11 deletions
diff --git a/src/xfns.c b/src/xfns.c
index f00335b5d03..6fcd129e4a4 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -2949,6 +2949,12 @@ unwind_create_frame (Lisp_Object frame)
return Qnil;
}
+static Lisp_Object
+unwind_create_frame_1 (Lisp_Object val)
+{
+ inhibit_window_configuration_change_hook = val;
+ return Qnil;
+}
static void
x_default_font_parameter (struct frame *f, Lisp_Object parms)
@@ -3321,17 +3327,31 @@ This function is an internal primitive--use `make-frame' instead. */)
happen. */
init_frame_faces (f);
- /* The X resources controlling the menu-bar and tool-bar are
- processed specially at startup, and reflected in the mode
- variables; ignore them here. */
- 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);
+ /* 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. */
+ {
+ int count2 = SPECPDL_INDEX ();
+ record_unwind_protect (unwind_create_frame_1,
+ inhibit_window_configuration_change_hook);
+ inhibit_window_configuration_change_hook = 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);
+ }
x_default_parameter (f, parms, Qbuffer_predicate, Qnil,
"bufferPredicate", "BufferPredicate",