diff options
| author | Alexander Gramiak | 2019-04-15 11:33:19 -0600 |
|---|---|---|
| committer | Alexander Gramiak | 2019-04-26 16:55:39 -0600 |
| commit | 46cfe5cb1fe9cca5e2fa9f993320c46b1b564609 (patch) | |
| tree | 30b9e3513f52d735a47186e8d32af224fb4c9381 /src | |
| parent | 5d8b0fadeec373cd2861328aeb1cb4293cbc9ded (diff) | |
| download | emacs-46cfe5cb1fe9cca5e2fa9f993320c46b1b564609.tar.gz emacs-46cfe5cb1fe9cca5e2fa9f993320c46b1b564609.zip | |
Check for existence of terminal hooks before use
This should not be necessary, and is merely a precaution. For
background, see:
https://lists.gnu.org/archive/html/emacs-devel/2019-04/msg00639.html
* src/frame.c:
* src/xdisp.c: Check for existence of terminal hooks before use.
Diffstat (limited to 'src')
| -rw-r--r-- | src/frame.c | 39 | ||||
| -rw-r--r-- | src/frame.h | 3 | ||||
| -rw-r--r-- | src/xdisp.c | 13 |
3 files changed, 33 insertions, 22 deletions
diff --git a/src/frame.c b/src/frame.c index 22a79859454..328facd2d5b 100644 --- a/src/frame.c +++ b/src/frame.c | |||
| @@ -482,7 +482,8 @@ keep_ratio (struct frame *f, struct frame *p, int old_width, int old_height, | |||
| 482 | f->top_pos = pos_y; | 482 | f->top_pos = pos_y; |
| 483 | } | 483 | } |
| 484 | 484 | ||
| 485 | FRAME_TERMINAL (f)->set_frame_offset_hook (f, pos_x, pos_y, -1); | 485 | if (FRAME_TERMINAL (f)->set_frame_offset_hook) |
| 486 | FRAME_TERMINAL (f)->set_frame_offset_hook (f, pos_x, pos_y, -1); | ||
| 486 | } | 487 | } |
| 487 | 488 | ||
| 488 | if (!CONSP (keep_ratio) || !NILP (Fcar (keep_ratio))) | 489 | if (!CONSP (keep_ratio) || !NILP (Fcar (keep_ratio))) |
| @@ -669,11 +670,12 @@ adjust_frame_size (struct frame *f, int new_width, int new_height, int inhibit, | |||
| 669 | list2 (inhibit_horizontal ? Qt : Qnil, | 670 | list2 (inhibit_horizontal ? Qt : Qnil, |
| 670 | inhibit_vertical ? Qt : Qnil)); | 671 | inhibit_vertical ? Qt : Qnil)); |
| 671 | 672 | ||
| 672 | FRAME_TERMINAL (f)->set_window_size_hook (f, | 673 | if (FRAME_TERMINAL (f)->set_window_size_hook) |
| 673 | 0, | 674 | FRAME_TERMINAL (f)->set_window_size_hook (f, |
| 674 | new_text_width, | 675 | 0, |
| 675 | new_text_height, | 676 | new_text_width, |
| 676 | 1); | 677 | new_text_height, |
| 678 | 1); | ||
| 677 | f->resized_p = true; | 679 | f->resized_p = true; |
| 678 | 680 | ||
| 679 | return; | 681 | return; |
| @@ -1370,7 +1372,7 @@ do_switch_frame (Lisp_Object frame, int track, int for_deletion, Lisp_Object nor | |||
| 1370 | #else /* ! 0 */ | 1372 | #else /* ! 0 */ |
| 1371 | /* Instead, apply it only to the frame we're pointing to. */ | 1373 | /* Instead, apply it only to the frame we're pointing to. */ |
| 1372 | #ifdef HAVE_WINDOW_SYSTEM | 1374 | #ifdef HAVE_WINDOW_SYSTEM |
| 1373 | if (track && FRAME_WINDOW_P (f)) | 1375 | if (track && FRAME_WINDOW_P (f) && FRAME_TERMINAL (f)->get_focus_frame) |
| 1374 | { | 1376 | { |
| 1375 | Lisp_Object focus, gfocus; | 1377 | Lisp_Object focus, gfocus; |
| 1376 | 1378 | ||
| @@ -2836,7 +2838,7 @@ If there is no window system support, this function does nothing. */) | |||
| 2836 | { | 2838 | { |
| 2837 | #ifdef HAVE_WINDOW_SYSTEM | 2839 | #ifdef HAVE_WINDOW_SYSTEM |
| 2838 | struct frame *f = decode_window_system_frame (frame); | 2840 | struct frame *f = decode_window_system_frame (frame); |
| 2839 | if (f) | 2841 | if (f && FRAME_TERMINAL (f)->focus_frame_hook) |
| 2840 | FRAME_TERMINAL (f)->focus_frame_hook (f, !NILP (noactivate)); | 2842 | FRAME_TERMINAL (f)->focus_frame_hook (f, !NILP (noactivate)); |
| 2841 | #endif | 2843 | #endif |
| 2842 | return Qnil; | 2844 | return Qnil; |
| @@ -3602,10 +3604,11 @@ bottom edge of FRAME's display. */) | |||
| 3602 | if (FRAME_WINDOW_P (f)) | 3604 | if (FRAME_WINDOW_P (f)) |
| 3603 | { | 3605 | { |
| 3604 | #ifdef HAVE_WINDOW_SYSTEM | 3606 | #ifdef HAVE_WINDOW_SYSTEM |
| 3605 | FRAME_TERMINAL (f)->set_frame_offset_hook (f, | 3607 | if (FRAME_TERMINAL (f)->set_frame_offset_hook) |
| 3606 | XFIXNUM (x), | 3608 | FRAME_TERMINAL (f)->set_frame_offset_hook (f, |
| 3607 | XFIXNUM (y), | 3609 | XFIXNUM (x), |
| 3608 | 1); | 3610 | XFIXNUM (y), |
| 3611 | 1); | ||
| 3609 | #endif | 3612 | #endif |
| 3610 | } | 3613 | } |
| 3611 | 3614 | ||
| @@ -4161,7 +4164,8 @@ gui_set_frame_parameters (struct frame *f, Lisp_Object alist) | |||
| 4161 | f->win_gravity = NorthWestGravity; | 4164 | f->win_gravity = NorthWestGravity; |
| 4162 | 4165 | ||
| 4163 | /* Actually set that position, and convert to absolute. */ | 4166 | /* Actually set that position, and convert to absolute. */ |
| 4164 | FRAME_TERMINAL (f)->set_frame_offset_hook (f, leftpos, toppos, -1); | 4167 | if (FRAME_TERMINAL (f)->set_frame_offset_hook) |
| 4168 | FRAME_TERMINAL (f)->set_frame_offset_hook (f, leftpos, toppos, -1); | ||
| 4165 | } | 4169 | } |
| 4166 | 4170 | ||
| 4167 | if (fullscreen_change) | 4171 | if (fullscreen_change) |
| @@ -4436,7 +4440,8 @@ gui_set_font (struct frame *f, Lisp_Object arg, Lisp_Object oldval) | |||
| 4436 | if (! NILP (Fequal (font_object, oldval))) | 4440 | if (! NILP (Fequal (font_object, oldval))) |
| 4437 | return; | 4441 | return; |
| 4438 | 4442 | ||
| 4439 | FRAME_TERMINAL (f)->set_new_font_hook (f, font_object, fontset); | 4443 | if (FRAME_TERMINAL (f)->set_new_font_hook) |
| 4444 | FRAME_TERMINAL (f)->set_new_font_hook (f, font_object, fontset); | ||
| 4440 | store_frame_param (f, Qfont, arg); | 4445 | store_frame_param (f, Qfont, arg); |
| 4441 | #ifdef HAVE_X_WINDOWS | 4446 | #ifdef HAVE_X_WINDOWS |
| 4442 | store_frame_param (f, Qfont_parameter, font_param); | 4447 | store_frame_param (f, Qfont_parameter, font_param); |
| @@ -4716,7 +4721,8 @@ gui_set_scroll_bar_width (struct frame *f, Lisp_Object arg, Lisp_Object oldval) | |||
| 4716 | } | 4721 | } |
| 4717 | else | 4722 | else |
| 4718 | { | 4723 | { |
| 4719 | FRAME_TERMINAL (f)->set_scroll_bar_default_width_hook (f); | 4724 | if (FRAME_TERMINAL (f)->set_scroll_bar_default_width_hook) |
| 4725 | FRAME_TERMINAL (f)->set_scroll_bar_default_width_hook (f); | ||
| 4720 | 4726 | ||
| 4721 | if (FRAME_NATIVE_WINDOW (f)) | 4727 | if (FRAME_NATIVE_WINDOW (f)) |
| 4722 | adjust_frame_size (f, -1, -1, 3, 0, Qscroll_bar_width); | 4728 | adjust_frame_size (f, -1, -1, 3, 0, Qscroll_bar_width); |
| @@ -4746,7 +4752,8 @@ gui_set_scroll_bar_height (struct frame *f, Lisp_Object arg, Lisp_Object oldval) | |||
| 4746 | } | 4752 | } |
| 4747 | else | 4753 | else |
| 4748 | { | 4754 | { |
| 4749 | FRAME_TERMINAL (f)->set_scroll_bar_default_height_hook (f); | 4755 | if (FRAME_TERMINAL (f)->set_scroll_bar_default_height_hook) |
| 4756 | FRAME_TERMINAL (f)->set_scroll_bar_default_height_hook (f); | ||
| 4750 | 4757 | ||
| 4751 | if (FRAME_NATIVE_WINDOW (f)) | 4758 | if (FRAME_NATIVE_WINDOW (f)) |
| 4752 | adjust_frame_size (f, -1, -1, 3, 0, Qscroll_bar_height); | 4759 | adjust_frame_size (f, -1, -1, 3, 0, Qscroll_bar_height); |
diff --git a/src/frame.h b/src/frame.h index e66590ef74f..70597737d49 100644 --- a/src/frame.h +++ b/src/frame.h | |||
| @@ -1602,7 +1602,8 @@ gui_set_bitmap_icon (struct frame *f) | |||
| 1602 | { | 1602 | { |
| 1603 | Lisp_Object obj = assq_no_quit (Qicon_type, f->param_alist); | 1603 | Lisp_Object obj = assq_no_quit (Qicon_type, f->param_alist); |
| 1604 | 1604 | ||
| 1605 | if (CONSP (obj) && !NILP (XCDR (obj))) | 1605 | if (CONSP (obj) && !NILP (XCDR (obj)) |
| 1606 | && FRAME_TERMINAL (f)->set_bitmap_icon_hook) | ||
| 1606 | FRAME_TERMINAL (f)->set_bitmap_icon_hook (f, XCDR (obj)); | 1607 | FRAME_TERMINAL (f)->set_bitmap_icon_hook (f, XCDR (obj)); |
| 1607 | } | 1608 | } |
| 1608 | 1609 | ||
diff --git a/src/xdisp.c b/src/xdisp.c index 19fbf93dd08..34e89c79046 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -12077,9 +12077,10 @@ gui_consider_frame_title (Lisp_Object frame) | |||
| 12077 | already wasted too much time by walking through the list with | 12077 | already wasted too much time by walking through the list with |
| 12078 | display_mode_element, then we might need to optimize at a | 12078 | display_mode_element, then we might need to optimize at a |
| 12079 | higher level than this.) */ | 12079 | higher level than this.) */ |
| 12080 | if (! STRINGP (f->name) | 12080 | if ((! STRINGP (f->name) |
| 12081 | || SBYTES (f->name) != len | 12081 | || SBYTES (f->name) != len |
| 12082 | || memcmp (title, SDATA (f->name), len) != 0) | 12082 | || memcmp (title, SDATA (f->name), len) != 0) |
| 12083 | && FRAME_TERMINAL (f)->implicit_set_name_hook) | ||
| 12083 | FRAME_TERMINAL (f)->implicit_set_name_hook (f, | 12084 | FRAME_TERMINAL (f)->implicit_set_name_hook (f, |
| 12084 | make_string (title, len), | 12085 | make_string (title, len), |
| 12085 | Qnil); | 12086 | Qnil); |
| @@ -12856,7 +12857,8 @@ redisplay_tool_bar (struct frame *f) | |||
| 12856 | 12857 | ||
| 12857 | if (new_height != WINDOW_PIXEL_HEIGHT (w)) | 12858 | if (new_height != WINDOW_PIXEL_HEIGHT (w)) |
| 12858 | { | 12859 | { |
| 12859 | FRAME_TERMINAL (f)->change_tool_bar_height_hook (f, new_height); | 12860 | if (FRAME_TERMINAL (f)->change_tool_bar_height_hook) |
| 12861 | FRAME_TERMINAL (f)->change_tool_bar_height_hook (f, new_height); | ||
| 12860 | frame_default_tool_bar_height = new_height; | 12862 | frame_default_tool_bar_height = new_height; |
| 12861 | /* Always do that now. */ | 12863 | /* Always do that now. */ |
| 12862 | clear_glyph_matrix (w->desired_matrix); | 12864 | clear_glyph_matrix (w->desired_matrix); |
| @@ -12951,7 +12953,8 @@ redisplay_tool_bar (struct frame *f) | |||
| 12951 | 12953 | ||
| 12952 | if (change_height_p) | 12954 | if (change_height_p) |
| 12953 | { | 12955 | { |
| 12954 | FRAME_TERMINAL (f)->change_tool_bar_height_hook (f, new_height); | 12956 | if (FRAME_TERMINAL (f)->change_tool_bar_height_hook) |
| 12957 | FRAME_TERMINAL (f)->change_tool_bar_height_hook (f, new_height); | ||
| 12955 | frame_default_tool_bar_height = new_height; | 12958 | frame_default_tool_bar_height = new_height; |
| 12956 | clear_glyph_matrix (w->desired_matrix); | 12959 | clear_glyph_matrix (w->desired_matrix); |
| 12957 | f->n_tool_bar_rows = nrows; | 12960 | f->n_tool_bar_rows = nrows; |