diff options
| author | Dmitry Antipov | 2014-08-03 11:19:43 +0400 |
|---|---|---|
| committer | Dmitry Antipov | 2014-08-03 11:19:43 +0400 |
| commit | a270fa7cf82cb23c6dcd84aab7f2c178ac0cca55 (patch) | |
| tree | 4ffeea577fb0b58e9d80ef93f5965f6b31049b97 /src | |
| parent | f91d04c6fef645f850b43c6b50aaa33648e99e2f (diff) | |
| download | emacs-a270fa7cf82cb23c6dcd84aab7f2c178ac0cca55.tar.gz emacs-a270fa7cf82cb23c6dcd84aab7f2c178ac0cca55.zip | |
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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 8 | ||||
| -rw-r--r-- | src/xfns.c | 41 |
2 files changed, 28 insertions, 21 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 93c27a6e565..3f9b4577460 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,11 @@ | |||
| 1 | 2014-08-03 Dmitry Antipov <dmantipov@yandex.ru> | ||
| 2 | |||
| 3 | Fix bug with an attempt to select uninitialized frame (Bug#18161). | ||
| 4 | * xfns.c (Fx_create_frame): Move call to change_frame_size to | ||
| 5 | a section where Lisp evaluation is disabled. This way a pointer | ||
| 6 | to uninitialized frame is not accessible from Lisp, which becomes | ||
| 7 | critical if following call to x_figure_window_size throws an error. | ||
| 8 | |||
| 1 | 2014-08-02 Paul Eggert <eggert@cs.ucla.edu> | 9 | 2014-08-02 Paul Eggert <eggert@cs.ucla.edu> |
| 2 | 10 | ||
| 3 | Fix bug with clang + directory_files_internal + GC (Bug#16986). | 11 | Fix bug with clang + directory_files_internal + GC (Bug#16986). |
diff --git a/src/xfns.c b/src/xfns.c index 23fba44f1f3..96a4b07b150 100644 --- a/src/xfns.c +++ b/src/xfns.c | |||
| @@ -2884,7 +2884,7 @@ This function is an internal primitive--use `make-frame' instead. */) | |||
| 2884 | int minibuffer_only = 0; | 2884 | int minibuffer_only = 0; |
| 2885 | long window_prompting = 0; | 2885 | long window_prompting = 0; |
| 2886 | int width, height; | 2886 | int width, height; |
| 2887 | ptrdiff_t count = SPECPDL_INDEX (); | 2887 | ptrdiff_t count = SPECPDL_INDEX (), count2; |
| 2888 | struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; | 2888 | struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; |
| 2889 | Lisp_Object display; | 2889 | Lisp_Object display; |
| 2890 | struct x_display_info *dpyinfo = NULL; | 2890 | struct x_display_info *dpyinfo = NULL; |
| @@ -3130,6 +3130,14 @@ This function is an internal primitive--use `make-frame' instead. */) | |||
| 3130 | end up in init_iterator with a null face cache, which should not | 3130 | end up in init_iterator with a null face cache, which should not |
| 3131 | happen. */ | 3131 | happen. */ |
| 3132 | init_frame_faces (f); | 3132 | init_frame_faces (f); |
| 3133 | |||
| 3134 | /* Temporary disable window-configuration-change-hook to avoid | ||
| 3135 | an infloop in next_frame and access to uninitialized frame | ||
| 3136 | from Lisp code (Bug#18161). */ | ||
| 3137 | |||
| 3138 | count2 = SPECPDL_INDEX (); | ||
| 3139 | record_unwind_protect (unwind_create_frame_1, inhibit_lisp_code); | ||
| 3140 | inhibit_lisp_code = Qt; | ||
| 3133 | 3141 | ||
| 3134 | /* PXW: This is a duplicate from below. We have to do it here since | 3142 | /* PXW: This is a duplicate from below. We have to do it here since |
| 3135 | otherwise x_set_tool_bar_lines will work with the character sizes | 3143 | otherwise x_set_tool_bar_lines will work with the character sizes |
| @@ -3145,27 +3153,18 @@ This function is an internal primitive--use `make-frame' instead. */) | |||
| 3145 | /* Set the menu-bar-lines and tool-bar-lines parameters. We don't | 3153 | /* Set the menu-bar-lines and tool-bar-lines parameters. We don't |
| 3146 | look up the X resources controlling the menu-bar and tool-bar | 3154 | look up the X resources controlling the menu-bar and tool-bar |
| 3147 | here; they are processed specially at startup, and reflected in | 3155 | here; they are processed specially at startup, and reflected in |
| 3148 | the values of the mode variables. | 3156 | the values of the mode variables. */ |
| 3149 | 3157 | ||
| 3150 | Avoid calling window-configuration-change-hook; otherwise we | 3158 | x_default_parameter (f, parms, Qmenu_bar_lines, |
| 3151 | could get an infloop in next_frame since the frame is not yet in | 3159 | NILP (Vmenu_bar_mode) |
| 3152 | Vframe_list. */ | 3160 | ? make_number (0) : make_number (1), |
| 3153 | { | 3161 | NULL, NULL, RES_TYPE_NUMBER); |
| 3154 | ptrdiff_t count2 = SPECPDL_INDEX (); | 3162 | x_default_parameter (f, parms, Qtool_bar_lines, |
| 3155 | record_unwind_protect (unwind_create_frame_1, inhibit_lisp_code); | 3163 | NILP (Vtool_bar_mode) |
| 3156 | inhibit_lisp_code = Qt; | 3164 | ? make_number (0) : make_number (1), |
| 3157 | 3165 | NULL, NULL, RES_TYPE_NUMBER); | |
| 3158 | x_default_parameter (f, parms, Qmenu_bar_lines, | 3166 | |
| 3159 | NILP (Vmenu_bar_mode) | 3167 | unbind_to (count2, Qnil); |
| 3160 | ? make_number (0) : make_number (1), | ||
| 3161 | NULL, NULL, RES_TYPE_NUMBER); | ||
| 3162 | x_default_parameter (f, parms, Qtool_bar_lines, | ||
| 3163 | NILP (Vtool_bar_mode) | ||
| 3164 | ? make_number (0) : make_number (1), | ||
| 3165 | NULL, NULL, RES_TYPE_NUMBER); | ||
| 3166 | |||
| 3167 | unbind_to (count2, Qnil); | ||
| 3168 | } | ||
| 3169 | 3168 | ||
| 3170 | x_default_parameter (f, parms, Qbuffer_predicate, Qnil, | 3169 | x_default_parameter (f, parms, Qbuffer_predicate, Qnil, |
| 3171 | "bufferPredicate", "BufferPredicate", | 3170 | "bufferPredicate", "BufferPredicate", |