diff options
author | Alexander Gramiak <agrambot@gmail.com> | 2019-04-15 11:33:19 -0600 |
---|---|---|
committer | Alexander Gramiak <agrambot@gmail.com> | 2019-04-15 11:33:19 -0600 |
commit | 032c534ecc5dde828c2ecf0393e8c612d1003b65 (patch) | |
tree | d05648c04e24ad90d6db6caed3c5083835e0e7e2 | |
parent | 4a662e848aaa1a4328307bde970a77ee9583eabe (diff) | |
download | emacs-032c534ecc5dde828c2ecf0393e8c612d1003b65.tar.gz |
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.
-rw-r--r-- | src/frame.c | 37 | ||||
-rw-r--r-- | src/xdisp.c | 13 |
2 files changed, 30 insertions, 20 deletions
diff --git a/src/frame.c b/src/frame.c index 9837cc34221..763dd505bd3 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, f->top_pos = pos_y; } - FRAME_TERMINAL (f)->set_frame_offset_hook (f, pos_x, pos_y, -1); + if (FRAME_TERMINAL (f)->set_frame_offset_hook) + FRAME_TERMINAL (f)->set_frame_offset_hook (f, pos_x, pos_y, -1); } 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, list2 (inhibit_horizontal ? Qt : Qnil, inhibit_vertical ? Qt : Qnil)); - FRAME_TERMINAL (f)->set_window_size_hook (f, - 0, - new_text_width, - new_text_height, - 1); + if (FRAME_TERMINAL (f)->set_window_size_hook) + FRAME_TERMINAL (f)->set_window_size_hook (f, + 0, + new_text_width, + new_text_height, + 1); f->resized_p = true; return; @@ -2835,7 +2837,7 @@ If there is no window system support, this function does nothing. */) { #ifdef HAVE_WINDOW_SYSTEM struct frame *f = decode_window_system_frame (frame); - if (f) + if (f && FRAME_TERMINAL (f)->focus_frame_hook) FRAME_TERMINAL (f)->focus_frame_hook (f, !NILP (noactivate)); #endif return Qnil; @@ -3601,10 +3603,11 @@ bottom edge of FRAME's display. */) if (FRAME_WINDOW_P (f)) { #ifdef HAVE_WINDOW_SYSTEM - FRAME_TERMINAL (f)->set_frame_offset_hook (f, - XFIXNUM (x), - XFIXNUM (y), - 1); + if (FRAME_TERMINAL (f)->set_frame_offset_hook) + FRAME_TERMINAL (f)->set_frame_offset_hook (f, + XFIXNUM (x), + XFIXNUM (y), + 1); #endif } @@ -4160,7 +4163,8 @@ gui_set_frame_parameters (struct frame *f, Lisp_Object alist) f->win_gravity = NorthWestGravity; /* Actually set that position, and convert to absolute. */ - FRAME_TERMINAL (f)->set_frame_offset_hook (f, leftpos, toppos, -1); + if (FRAME_TERMINAL (f)->set_frame_offset_hook) + FRAME_TERMINAL (f)->set_frame_offset_hook (f, leftpos, toppos, -1); } if (fullscreen_change) @@ -4435,7 +4439,8 @@ gui_set_font (struct frame *f, Lisp_Object arg, Lisp_Object oldval) if (! NILP (Fequal (font_object, oldval))) return; - FRAME_TERMINAL (f)->set_new_font_hook (f, font_object, fontset); + if (FRAME_TERMINAL (f)->set_new_font_hook) + FRAME_TERMINAL (f)->set_new_font_hook (f, font_object, fontset); store_frame_param (f, Qfont, arg); #ifdef HAVE_X_WINDOWS store_frame_param (f, Qfont_parameter, font_param); @@ -4715,7 +4720,8 @@ gui_set_scroll_bar_width (struct frame *f, Lisp_Object arg, Lisp_Object oldval) } else { - FRAME_TERMINAL (f)->set_scroll_bar_default_width_hook (f); + if (FRAME_TERMINAL (f)->set_scroll_bar_default_width_hook) + FRAME_TERMINAL (f)->set_scroll_bar_default_width_hook (f); if (FRAME_NATIVE_WINDOW (f)) adjust_frame_size (f, -1, -1, 3, 0, Qscroll_bar_width); @@ -4745,7 +4751,8 @@ gui_set_scroll_bar_height (struct frame *f, Lisp_Object arg, Lisp_Object oldval) } else { - FRAME_TERMINAL (f)->set_scroll_bar_default_height_hook (f); + if (FRAME_TERMINAL (f)->set_scroll_bar_default_height_hook) + FRAME_TERMINAL (f)->set_scroll_bar_default_height_hook (f); if (FRAME_NATIVE_WINDOW (f)) adjust_frame_size (f, -1, -1, 3, 0, Qscroll_bar_height); diff --git a/src/xdisp.c b/src/xdisp.c index 371fdf462a6..2950085b3a7 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -12069,9 +12069,10 @@ gui_consider_frame_title (Lisp_Object frame) already wasted too much time by walking through the list with display_mode_element, then we might need to optimize at a higher level than this.) */ - if (! STRINGP (f->name) - || SBYTES (f->name) != len - || memcmp (title, SDATA (f->name), len) != 0) + if ((! STRINGP (f->name) + || SBYTES (f->name) != len + || memcmp (title, SDATA (f->name), len) != 0) + && FRAME_TERMINAL (f)->implicit_set_name_hook) FRAME_TERMINAL (f)->implicit_set_name_hook (f, make_string (title, len), Qnil); @@ -12848,7 +12849,8 @@ redisplay_tool_bar (struct frame *f) if (new_height != WINDOW_PIXEL_HEIGHT (w)) { - FRAME_TERMINAL (f)->change_tool_bar_height_hook (f, new_height); + if (FRAME_TERMINAL (f)->change_tool_bar_height_hook) + FRAME_TERMINAL (f)->change_tool_bar_height_hook (f, new_height); frame_default_tool_bar_height = new_height; /* Always do that now. */ clear_glyph_matrix (w->desired_matrix); @@ -12943,7 +12945,8 @@ redisplay_tool_bar (struct frame *f) if (change_height_p) { - FRAME_TERMINAL (f)->change_tool_bar_height_hook (f, new_height); + if (FRAME_TERMINAL (f)->change_tool_bar_height_hook) + FRAME_TERMINAL (f)->change_tool_bar_height_hook (f, new_height); frame_default_tool_bar_height = new_height; clear_glyph_matrix (w->desired_matrix); f->n_tool_bar_rows = nrows; |