diff options
| author | Chong Yidong | 2012-02-23 15:28:21 +0800 |
|---|---|---|
| committer | Chong Yidong | 2012-02-23 15:28:21 +0800 |
| commit | f01d3321d5a7ca4147b675f02d5aa51dc65c2b55 (patch) | |
| tree | d300ae3022865077969c1a27c539a4bd7bf59381 /src | |
| parent | 8f4042d244cc9dd4eb05ec9756020fd03ca36eab (diff) | |
| download | emacs-f01d3321d5a7ca4147b675f02d5aa51dc65c2b55.tar.gz emacs-f01d3321d5a7ca4147b675f02d5aa51dc65c2b55.zip | |
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')
| -rw-r--r-- | src/ChangeLog | 9 | ||||
| -rw-r--r-- | src/window.c | 5 | ||||
| -rw-r--r-- | src/window.h | 4 | ||||
| -rw-r--r-- | src/xfns.c | 42 |
4 files changed, 48 insertions, 12 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 5a376c4ad5b..3d660159a1a 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,12 @@ | |||
| 1 | 2012-02-23 Chong Yidong <cyd@gnu.org> | ||
| 2 | |||
| 3 | * xfns.c (Fx_create_frame): Avoid window-configuration-change-hook | ||
| 4 | call when setting menu-bar-lines and tool-bar-lines parameters. | ||
| 5 | (unwind_create_frame_1): New helper function. | ||
| 6 | |||
| 7 | * window.c (inhibit_window_configuration_change_hook): New var. | ||
| 8 | (run_window_configuration_change_hook): Obey it. | ||
| 9 | |||
| 1 | 2012-02-22 Chong Yidong <cyd@gnu.org> | 10 | 2012-02-22 Chong Yidong <cyd@gnu.org> |
| 2 | 11 | ||
| 3 | * xterm.c (x_draw_image_relief): Add missing type check for | 12 | * xterm.c (x_draw_image_relief): Add missing type check for |
diff --git a/src/window.c b/src/window.c index 95e7d8a5685..397d84a8b05 100644 --- a/src/window.c +++ b/src/window.c | |||
| @@ -122,6 +122,9 @@ static int window_initialized; | |||
| 122 | /* Hook to run when window config changes. */ | 122 | /* Hook to run when window config changes. */ |
| 123 | static Lisp_Object Qwindow_configuration_change_hook; | 123 | static Lisp_Object Qwindow_configuration_change_hook; |
| 124 | 124 | ||
| 125 | /* If non-nil, run_window_configuration_change_hook does nothing. */ | ||
| 126 | Lisp_Object inhibit_window_configuration_change_hook; | ||
| 127 | |||
| 125 | /* Used by the function window_scroll_pixel_based */ | 128 | /* Used by the function window_scroll_pixel_based */ |
| 126 | static int window_scroll_pixel_based_preserve_x; | 129 | static int window_scroll_pixel_based_preserve_x; |
| 127 | static int window_scroll_pixel_based_preserve_y; | 130 | static int window_scroll_pixel_based_preserve_y; |
| @@ -2894,7 +2897,7 @@ run_window_configuration_change_hook (struct frame *f) | |||
| 2894 | = Fdefault_value (Qwindow_configuration_change_hook); | 2897 | = Fdefault_value (Qwindow_configuration_change_hook); |
| 2895 | XSETFRAME (frame, f); | 2898 | XSETFRAME (frame, f); |
| 2896 | 2899 | ||
| 2897 | if (NILP (Vrun_hooks)) | 2900 | if (NILP (Vrun_hooks) || !NILP (inhibit_window_configuration_change_hook)) |
| 2898 | return; | 2901 | return; |
| 2899 | 2902 | ||
| 2900 | /* Use the right buffer. Matters when running the local hooks. */ | 2903 | /* Use the right buffer. Matters when running the local hooks. */ |
diff --git a/src/window.h b/src/window.h index ea127ca95a8..f4a5f52b9a5 100644 --- a/src/window.h +++ b/src/window.h | |||
| @@ -810,6 +810,10 @@ extern Lisp_Object Vmouse_window; | |||
| 810 | 810 | ||
| 811 | extern Lisp_Object Vmouse_event; | 811 | extern Lisp_Object Vmouse_event; |
| 812 | 812 | ||
| 813 | /* If non-nil, run_window_configuration_change_hook does nothing. */ | ||
| 814 | |||
| 815 | extern Lisp_Object inhibit_window_configuration_change_hook; | ||
| 816 | |||
| 813 | EXFUN (Fnext_window, 3); | 817 | EXFUN (Fnext_window, 3); |
| 814 | EXFUN (Fselect_window, 2); | 818 | EXFUN (Fselect_window, 2); |
| 815 | EXFUN (Fset_window_buffer, 3); | 819 | EXFUN (Fset_window_buffer, 3); |
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) | |||
| 2949 | return Qnil; | 2949 | return Qnil; |
| 2950 | } | 2950 | } |
| 2951 | 2951 | ||
| 2952 | static Lisp_Object | ||
| 2953 | unwind_create_frame_1 (Lisp_Object val) | ||
| 2954 | { | ||
| 2955 | inhibit_window_configuration_change_hook = val; | ||
| 2956 | return Qnil; | ||
| 2957 | } | ||
| 2952 | 2958 | ||
| 2953 | static void | 2959 | static void |
| 2954 | x_default_font_parameter (struct frame *f, Lisp_Object parms) | 2960 | x_default_font_parameter (struct frame *f, Lisp_Object parms) |
| @@ -3321,17 +3327,31 @@ This function is an internal primitive--use `make-frame' instead. */) | |||
| 3321 | happen. */ | 3327 | happen. */ |
| 3322 | init_frame_faces (f); | 3328 | init_frame_faces (f); |
| 3323 | 3329 | ||
| 3324 | /* The X resources controlling the menu-bar and tool-bar are | 3330 | /* Set the menu-bar-lines and tool-bar-lines parameters. We don't |
| 3325 | processed specially at startup, and reflected in the mode | 3331 | look up the X resources controlling the menu-bar and tool-bar |
| 3326 | variables; ignore them here. */ | 3332 | here; they are processed specially at startup, and reflected in |
| 3327 | x_default_parameter (f, parms, Qmenu_bar_lines, | 3333 | the values of the mode variables. |
| 3328 | NILP (Vmenu_bar_mode) | 3334 | |
| 3329 | ? make_number (0) : make_number (1), | 3335 | Avoid calling window-configuration-change-hook; otherwise we |
| 3330 | NULL, NULL, RES_TYPE_NUMBER); | 3336 | could get an infloop in next_frame since the frame is not yet in |
| 3331 | x_default_parameter (f, parms, Qtool_bar_lines, | 3337 | Vframe_list. */ |
| 3332 | NILP (Vtool_bar_mode) | 3338 | { |
| 3333 | ? make_number (0) : make_number (1), | 3339 | int count2 = SPECPDL_INDEX (); |
| 3334 | NULL, NULL, RES_TYPE_NUMBER); | 3340 | record_unwind_protect (unwind_create_frame_1, |
| 3341 | inhibit_window_configuration_change_hook); | ||
| 3342 | inhibit_window_configuration_change_hook = Qt; | ||
| 3343 | |||
| 3344 | x_default_parameter (f, parms, Qmenu_bar_lines, | ||
| 3345 | NILP (Vmenu_bar_mode) | ||
| 3346 | ? make_number (0) : make_number (1), | ||
| 3347 | NULL, NULL, RES_TYPE_NUMBER); | ||
| 3348 | x_default_parameter (f, parms, Qtool_bar_lines, | ||
| 3349 | NILP (Vtool_bar_mode) | ||
| 3350 | ? make_number (0) : make_number (1), | ||
| 3351 | NULL, NULL, RES_TYPE_NUMBER); | ||
| 3352 | |||
| 3353 | unbind_to (count2, Qnil); | ||
| 3354 | } | ||
| 3335 | 3355 | ||
| 3336 | x_default_parameter (f, parms, Qbuffer_predicate, Qnil, | 3356 | x_default_parameter (f, parms, Qbuffer_predicate, Qnil, |
| 3337 | "bufferPredicate", "BufferPredicate", | 3357 | "bufferPredicate", "BufferPredicate", |