From fd16b54c7242d59f78b4cf150432314f0bb5f583 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Mon, 15 Apr 2013 10:27:56 +0300 Subject: [PATCH] More debugging code to investigate bug #14062. src/w32fns.c (w32_wnd_proc): Add more assertions to investigate bug#14062. src/frame.h (WINDOW_FRAME): Protect macro and its argument with parentheses. src/dispextern.h (CURRENT_MODE_LINE_HEIGHT) (CURRENT_HEADER_LINE_HEIGHT, WINDOW_WANTS_MODELINE_P) (WINDOW_WANTS_HEADER_LINE_P): Protect macro arguments with parentheses where appropriate. --- src/ChangeLog | 13 +++++++++++++ src/dispextern.h | 24 ++++++++++++------------ src/frame.h | 2 +- src/w32fns.c | 2 ++ 4 files changed, 28 insertions(+), 13 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 5c0e26760c7..1d113260478 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,16 @@ +2013-04-15 Eli Zaretskii + + * w32fns.c (w32_wnd_proc): Add more assertions to investigate + bug#14205. + + * frame.h (WINDOW_FRAME): Protect macro and its argument with + parentheses. + + * dispextern.h (CURRENT_MODE_LINE_HEIGHT) + (CURRENT_HEADER_LINE_HEIGHT, WINDOW_WANTS_MODELINE_P) + (WINDOW_WANTS_HEADER_LINE_P): Protect macro arguments with + parentheses where appropriate. + 2013-04-14 Paul Eggert * keyboard.c (timer_start_idle): Remove no-longer-used local. diff --git a/src/dispextern.h b/src/dispextern.h index cb2e944d1cc..9dc3a57c284 100644 --- a/src/dispextern.h +++ b/src/dispextern.h @@ -1384,7 +1384,7 @@ struct glyph_string ? current_mode_line_height \ : (MATRIX_MODE_LINE_HEIGHT ((W)->current_matrix) \ ? MATRIX_MODE_LINE_HEIGHT ((W)->current_matrix) \ - : estimate_mode_line_height (XFRAME (W->frame), \ + : estimate_mode_line_height (XFRAME ((W)->frame), \ CURRENT_MODE_LINE_FACE_ID (W)))) /* Return the current height of the header line of window W. If not @@ -1397,7 +1397,7 @@ struct glyph_string ? current_header_line_height \ : (MATRIX_HEADER_LINE_HEIGHT ((W)->current_matrix) \ ? MATRIX_HEADER_LINE_HEIGHT ((W)->current_matrix) \ - : estimate_mode_line_height (XFRAME (W->frame),\ + : estimate_mode_line_height (XFRAME ((W)->frame), \ HEADER_LINE_FACE_ID))) /* Return the height of the desired mode line of window W. */ @@ -1416,20 +1416,20 @@ struct glyph_string (!MINI_WINDOW_P ((W)) \ && !(W)->pseudo_window_p \ && FRAME_WANTS_MODELINE_P (XFRAME (WINDOW_FRAME ((W)))) \ - && BUFFERP (W->contents) \ - && !NILP (BVAR (XBUFFER (W->contents), mode_line_format)) \ + && BUFFERP ((W)->contents) \ + && !NILP (BVAR (XBUFFER ((W)->contents), mode_line_format)) \ && WINDOW_TOTAL_LINES (W) > 1) /* Value is true if window W wants a header line. */ -#define WINDOW_WANTS_HEADER_LINE_P(W) \ - (!MINI_WINDOW_P ((W)) \ - && !(W)->pseudo_window_p \ - && FRAME_WANTS_MODELINE_P (XFRAME (WINDOW_FRAME ((W)))) \ - && BUFFERP (W->contents) \ - && !NILP (BVAR (XBUFFER (W->contents), header_line_format)) \ - && WINDOW_TOTAL_LINES (W) > 1 \ - + !NILP (BVAR (XBUFFER (W->contents), mode_line_format))) +#define WINDOW_WANTS_HEADER_LINE_P(W) \ + (!MINI_WINDOW_P ((W)) \ + && !(W)->pseudo_window_p \ + && FRAME_WANTS_MODELINE_P (XFRAME (WINDOW_FRAME ((W)))) \ + && BUFFERP ((W)->contents) \ + && !NILP (BVAR (XBUFFER ((W)->contents), header_line_format)) \ + && WINDOW_TOTAL_LINES (W) > 1 \ + + !NILP (BVAR (XBUFFER ((W)->contents), mode_line_format))) /* Return proper value to be used as baseline offset of font that has ASCENT and DESCENT to draw characters by the font at the vertical diff --git a/src/frame.h b/src/frame.h index b69f19b7ef8..fc0a1dc828b 100644 --- a/src/frame.h +++ b/src/frame.h @@ -598,7 +598,7 @@ typedef struct frame *FRAME_PTR; #define XSETFRAME(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_FRAME)) /* Given a window, return its frame as a Lisp_Object. */ -#define WINDOW_FRAME(w) w->frame +#define WINDOW_FRAME(w) ((w)->frame) /* Test a frame for particular kinds of display methods. */ #define FRAME_INITIAL_P(f) ((f)->output_method == output_initial) diff --git a/src/w32fns.c b/src/w32fns.c index 5d3a78f8b95..de52ff144e3 100644 --- a/src/w32fns.c +++ b/src/w32fns.c @@ -3123,6 +3123,8 @@ w32_wnd_proc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) #ifdef ENABLE_CHECKING /* Temporary code to catch crashes in computing form.rcArea.top. */ + eassert (FRAMEP (w->frame)); + eassert (BUFFERP (w->contents)); { int wmbp = WINDOW_MENU_BAR_P (w); int wtbp = WINDOW_TOOL_BAR_P (w); -- 2.39.2