NOTE: This patch has been committed.
Undoubtedly, such race conditions exist in 21.4. However, I'm not sure
what state the code is in, and thus how hard it would be to port this.
Maybe someone else who has some time can investigate and see what would be
involved in the porting.
src/ChangeLog addition:
2005-01-26 Ben Wing <ben(a)xemacs.org>
* redisplay.c:
* redisplay.c (generate_displayable_area):
* redisplay.c (regenerate_window):
* redisplay.h:
* signal.c:
* signal.c (check_quit):
Move backtraces to internals manual. Fix some race conditions
leading to crashes due to incomplete protection of critical
sections. In signal.c, be more aggressive in catching incomplete
critical section protection -- we cannot even check for QUIT,
*EVER*, in a critical section.
symlink source patch:
Diff command: bash -ci "cvs-diff --show-c-function -no-changelog "
Files affected: src/redisplay.h src/signal.c src/redisplay.c
Index: src/redisplay.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/redisplay.c,v
retrieving revision 1.93
diff -u -p -r1.93 redisplay.c
--- src/redisplay.c 2005/01/24 23:34:08 1.93
+++ src/redisplay.c 2005/01/26 10:31:52
@@ -5285,112 +5285,11 @@ generate_string_display_line (struct win
return ret_charcount;
}
+/*
-/* Tricky tricky tricky. generate_displayable_area() can (could) be called reentrantly, and redisplay is not prepared to handle this:
+Info on Re-entrancy crashes, with backtraces given:
-assert_failed(const char * 0x0129c8c8 `string', int 5328, const char * 0x01274068 `string') line 3620
-Dynarr_verify_mod_1(void * 0x0250f228, const char * 0x0129c8c8 `string', int 5328) line 1256 + 36 bytes
-generate_displayable_area(window * 0x02480028, long 38776292, int 0, int 0, int 265, int 169, display_line_dynarr * 0x0250f228, long 0, int 2) line 5328 + 25 bytes
-output_gutter(frame * 0x0228ad90, gutter_pos TOP_GUTTER, int 1) line 409 + 69 bytes
-redraw_exposed_gutter(frame * 0x0228ad90, gutter_pos TOP_GUTTER, int 8, int 23, int 249, int 127) line 687 + 15 bytes
-redraw_exposed_gutters(frame * 0x0228ad90, int 8, int 23, int 249, int 127) line 703 + 29 bytes
-mswindows_redraw_exposed_area(frame * 0x0228ad90, int 8, int 23, int 249, int 127) line 862 + 25 bytes
-mswindows_handle_paint(frame * 0x0228ad90) line 2176 + 25 bytes
-mswindows_wnd_proc(HWND__ * 0x001003e2, unsigned int 15, unsigned int 0, long 0) line 3233 + 45 bytes
-intercepted_wnd_proc(HWND__ * 0x001003e2, unsigned int 15, unsigned int 0, long 0) line 2488
-USER32! 77e3a244()
-USER32! 77e14730()
-USER32! 77e1558a()
-NTDLL! KiUserCallbackDispatcher@12 + 19 bytes
-USER32! 77e14680()
-USER32! 77e1a792()
-qxeIsDialogMessage(HWND__ * 0x001003e2, tagMSG * 0x0082a93c {msg=0x0000000f wp=0x00000000 lp=0x00000000}) line 2298 + 14 bytes
-mswindows_is_dialog_msg(tagMSG * 0x0082a93c {msg=0x0000000f wp=0x00000000 lp=0x00000000}) line 165 + 13 bytes
-mswindows_drain_windows_queue(int 0) line 1282 + 9 bytes
-emacs_mswindows_drain_queue() line 1326 + 7 bytes
-event_stream_drain_queue() line 1887
-event_stream_quit_p() line 1992
-check_quit() line 993
-unbind_to_hairy(int 35) line 5963
-unbind_to_1(int 35, long 20888208) line 5945 + 200 bytes
-specifier_instance_from_inst_list(long 21379344, long 38135616, long 36220304, long 20888208, _error_behavior_struct_ {...}, int 1, long 3) line 2522 + 16 bytes
-specifier_instance(long 21379344, long 38135616, long 36220304, _error_behavior_struct_ {...}, int 1, int 0, long 3) line 2625 + 65 bytes
-specifier_instance_no_quit(long 21379344, long 38135616, long 36220304, _error_behavior_struct_ {...}, int 0, long 1) line 2658 + 31 bytes
-face_property_matching_instance(long 22612340, long 20860632, long 22530956, long 36220304, _error_behavior_struct_ {...}, int 0, long 1) line 565 + 48 bytes
-ensure_face_cachel_contains_charset(face_cachel * 0x0082b014, long 36220304, long 22530956) line 1104 + 35 bytes
-update_face_cachel_data(face_cachel * 0x0082b014, long 36220304, long 22612340) line 1304 + 19 bytes
-query_string_geometry(long 21110576, long 22612340, int * 0x00000000, int * 0x0082b5b4, int * 0x00000000, long 38852960) line 2370 + 23 bytes
-mswindows_widget_query_string_geometry(long 21110576, long 22612340, int * 0x0082b5b8, int * 0x0082b5b4, long 38852960) line 2914 + 25 bytes
-widget_query_string_geometry(long 21110576, long 22612340, int * 0x0082b5b8, int * 0x0082b5b4, long 38852960) line 514 + 32 bytes
-edit_field_query_geometry(long 38857648, int * 0x0082b7b4, int * 0x0082b7b8, image_instance_geometry IMAGE_DESIRED_GEOMETRY, long 38852960) line 920 + 390 bytes
-widget_query_geometry(long 38857648, int * 0x0082b7b4, int * 0x0082b7b8, image_instance_geometry IMAGE_DESIRED_GEOMETRY, long 38852960) line 567 + 26 bytes
-image_instance_query_geometry(long 38857648, int * 0x0082b7b4, int * 0x0082b7b8, image_instance_geometry IMAGE_DESIRED_GEOMETRY, long 38852960) line 2015 + 26 bytes
-glyph_query_geometry(long 38853384, int * 0x0082b7b4, int * 0x0082b7b8, image_instance_geometry IMAGE_DESIRED_GEOMETRY, long 38852960) line 4197 + 25 bytes
-layout_query_geometry(long 38852960, int * 0x0082b9cc, int * 0x0082b9d0, image_instance_geometry IMAGE_DESIRED_GEOMETRY, long 38404624) line 1351 + 25 bytes
-widget_query_geometry(long 38852960, int * 0x0082b9cc, int * 0x0082b9d0, image_instance_geometry IMAGE_DESIRED_GEOMETRY, long 38404624) line 567 + 26 bytes
-image_instance_query_geometry(long 38852960, int * 0x0082b9cc, int * 0x0082b9d0, image_instance_geometry IMAGE_DESIRED_GEOMETRY, long 38404624) line 2015 + 26 bytes
-glyph_query_geometry(long 38537976, int * 0x0082b9cc, int * 0x0082b9d0, image_instance_geometry IMAGE_DESIRED_GEOMETRY, long 38404624) line 4197 + 25 bytes
-layout_layout(long 38404624, int 265, int 156, int -2, int -2, long 38273064) line 1468 + 23 bytes
-widget_layout(long 38404624, int 265, int 156, int -2, int -2, long 38273064) line 626 + 30 bytes
-image_instance_layout(long 38404624, int 265, int 156, int -2, int -2, long 38273064) line 2102 + 51 bytes
-glyph_ascent(long 38404624, long 38273064) line 4009 + 21 bytes
-update_glyph_cachel_data(window * 0x02480028, long 36201168, glyph_cachel * 0x0248c3d8) line 4272 + 13 bytes
-get_glyph_cachel_index(window * 0x02480028, long 36201168) line 4306 + 17 bytes
-add_glyph_rune(position_redisplay_data_type * 0x0082bf2c, glyph_block * 0x024bd028, int 0, int 0, glyph_cachel * 0x00000000) line 1800 + 15 bytes
-add_glyph_runes(position_redisplay_data_type * 0x0082bf2c, int 0) line 2085 + 31 bytes
-create_string_text_block(window * 0x02480028, long 38776292, display_line * 0x02514500, long 0, prop_block_dynarr * * 0x0082c13c, int 2) line 4907 + 14 bytes
-generate_string_display_line(window * 0x02480028, long 38776292, display_line * 0x02514500, long 0, prop_block_dynarr * * 0x0082c13c, int 2) line 5293 + 29 bytes
-generate_displayable_area(window * 0x02480028, long 38776292, int 0, int 0, int 265, int 169, display_line_dynarr * 0x0250f228, long 0, int 2) line 5372 + 29 bytes
-output_gutter(frame * 0x0228ad90, gutter_pos TOP_GUTTER, int 0) line 409 + 69 bytes
-update_frame_gutters(frame * 0x0228ad90) line 639 + 15 bytes
-redisplay_frame(frame * 0x0228ad90, int 1) line 6792 + 9 bytes
-redisplay_device(device * 0x0171df00, int 1) line 6911 + 11 bytes
-redisplay_without_hooks() line 6957 + 11 bytes
-redisplay_no_pre_idle_hook() line 7029
-redisplay() line 7011
-mswindows_wnd_proc(HWND__ * 0x001003e2, unsigned int 5, unsigned int 0, long 10223881) line 3424
-intercepted_wnd_proc(HWND__ * 0x001003e2, unsigned int 5, unsigned int 0, long 10223881) line 2488
-USER32! 77e3a244()
-USER32! 77e16362()
-USER32! 77e14c1a()
-USER32! 77e1dd30()
-mswindows_wnd_proc(HWND__ * 0x001003e2, unsigned int 71, unsigned int 0, long 8578308) line 3926 + 21 bytes
-intercepted_wnd_proc(HWND__ * 0x001003e2, unsigned int 71, unsigned int 0, long 8578308) line 2488
-USER32! 77e3a244()
-USER32! 77e14730()
-USER32! 77e174b4()
-NTDLL! KiUserCallbackDispatcher@12 + 19 bytes
-mswindows_set_frame_size(frame * 0x0228ad90, int 265, int 156) line 355
-internal_set_frame_size(frame * 0x0228ad90, int 265, int 156, int 0) line 2754 + 24 bytes
-Fset_frame_displayable_pixel_size(long 36220304, long 531, long 313, long 20888208) line 3004 + 32 bytes
-Ffuncall(int 4, long * 0x0082e778) line 3844 + 168 bytes
-execute_optimized_program(const unsigned char * 0x02286e48, int 40, long * 0x01529b80) line 609 + 16 bytes
-funcall_compiled_function(long 22433308, int 0, long * 0x0082ec08) line 3452 + 85 bytes
-Ffuncall(int 1, long * 0x0082ec04) line 3883 + 17 bytes
-execute_optimized_program(const unsigned char * 0x02286d40, int 6, long * 0x01548ddc) line 609 + 16 bytes
-funcall_compiled_function(long 22505864, int 11, long * 0x0082f00c) line 3452 + 85 bytes
-Ffuncall(int 12, long * 0x0082f008) line 3883 + 17 bytes
-execute_optimized_program(const unsigned char * 0x02503e38, int 47, long * 0x0152dc48) line 609 + 16 bytes
-funcall_compiled_function(long 22436784, int 0, long * 0x0082f534) line 3452 + 85 bytes
-Ffuncall(int 1, long * 0x0082f530) line 3883 + 17 bytes
-apply1(long 22436784, long 20888208) line 4458 + 11 bytes
-Fcall_interactively(long 20742816, long 20888208, long 20888208) line 460 + 13 bytes
-Ffuncall(int 2, long * 0x0082f8ec) line 3844 + 127 bytes
-call1(long 20854392, long 20742816) line 4489 + 11 bytes
-execute_command_event(command_builder * 0x01798f98, long 24439276) line 4198 + 69 bytes
-Fdispatch_event(long 24439276) line 4569 + 13 bytes
-Fcommand_loop_1() line 569 + 9 bytes
-command_loop_1(long 20888208) line 489
-condition_case_1(long 20886024, long (long)* 0x010955a0 command_loop_1(long), long 20888208, long (long, long)* 0x01095150 cmd_error(long, long), long 20888208) line 1917 + 7 bytes
-command_loop_3() line 251 + 35 bytes
-command_loop_2(long 20888208) line 264
-internal_catch(long 20650992, long (long)* 0x010952c0 command_loop_2(long), long 20888208, int * volatile 0x00000000, long * volatile 0x00000000) line 1527 + 7 bytes
-initial_command_loop(long 20888208) line 300 + 28 bytes
-xemacs_21_5_b10_i586_pc_win32(int 1, char * * 0x00e52620, char * * 0x00e52bb0, int 0) line 2356
-main(int 1, char * * 0x00e52620, char * * 0x00e52bb0) line 2733
-mainCRTStartup() line 338 + 17 bytes
-KERNEL32! 77ea847c()
-
+ (Info-goto-node "(internals)Nasty Bugs due to Reentrancy in Redisplay Structures handling QUIT")
*/
@@ -5406,17 +5305,22 @@ generate_displayable_area (struct window
{
int yend = ypos + height;
Charcount s_zv;
-
prop_block_dynarr *prop = 0;
layout_bounds bounds;
- assert (dla);
+ int depth = -1;
- Dynarr_reset (dla);
/* if there's nothing to do then do nothing. code after this assumes
there is something to do. */
if (NILP (disp_string))
return;
+ /* See comment in regenerate_window() */
+ if (!in_display)
+ depth = enter_redisplay_critical_section ();
+
+ assert (dla);
+ Dynarr_reset (dla);
+
s_zv = string_char_length (disp_string);
bounds.left_out = xpos;
@@ -5496,6 +5400,9 @@ generate_displayable_area (struct window
if (prop)
Dynarr_free (prop);
+
+ if (depth >= 0)
+ exit_redisplay_critical_section (depth);
}
@@ -5512,7 +5419,8 @@ generate_displayable_area (struct window
changed it to the echo area buffer. */
static void
-regenerate_window (struct window *w, Charbpos start_pos, Charbpos point, int type)
+regenerate_window (struct window *w, Charbpos start_pos, Charbpos point,
+ int type)
{
struct frame *f = XFRAME (w->frame);
struct buffer *b = XBUFFER (w->buffer);
@@ -5520,6 +5428,7 @@ regenerate_window (struct window *w, Cha
int yend; /* set farther down */
int yclip = WINDOW_TEXT_TOP_CLIP (w);
int force;
+ int depth = -1;
prop_block_dynarr *prop;
layout_bounds bounds;
@@ -5529,6 +5438,19 @@ regenerate_window (struct window *w, Cha
/* The lines had better exist by this point. */
if (!(dla = window_display_lines (w, type)))
ABORT ();
+
+ if (!in_display)
+ depth = enter_redisplay_critical_section ();
+
+ /* This is one spot where a re-entrancy crash will occur, due to a check
+ in the dynarr to make sure it isn't "locked" */
+/*
+
+Info on Re-entrancy crashes, with backtraces given:
+
+ (Info-goto-node "(internals)Nasty Bugs due to Reentrancy in Redisplay Structures handling QUIT")
+*/
+
Dynarr_reset (dla);
w->max_line_len = 0;
@@ -5709,6 +5631,9 @@ regenerate_window (struct window *w, Cha
there when we first started working in this function. */
generate_modeline (w, Dynarr_atp (dla, 0), type);
}
+
+ if (depth >= 0)
+ exit_redisplay_critical_section (depth);
}
#define REGEN_INC_FIND_START_END \
Index: src/signal.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/signal.c,v
retrieving revision 1.28
diff -u -p -r1.28 signal.c
--- src/signal.c 2005/01/24 23:34:10 1.28
+++ src/signal.c 2005/01/26 10:31:54
@@ -1,6 +1,6 @@
/* Handling asynchronous signals.
Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc.
- Copyright (C) 1995, 1996, 2001, 2002 Ben Wing.
+ Copyright (C) 1995, 1996, 2001, 2002, 2004 Ben Wing.
This file is part of XEmacs.
@@ -693,163 +693,11 @@ begin_do_check_for_quit (void)
The C-g or Sh-C-g is discarded, so it won't be noticed again.
*/
+
+
void
check_quit (void)
{
- /* dont_check_for_quit is set in three circumstances:
-
- (1) when we are in the process of changing the window
- configuration. The frame might be in an inconsistent state,
- which will cause assertion failures if we check for QUIT.
-
- (2) when we are reading events, and want to read the C-g
- as an event. The normal check for quit will discard the C-g,
- which would be bad.
-
- (3) when we're going down with a fatal error. we're most likely
- in an inconsistent state, and we definitely don't want to be
- interrupted. */
-
- /* We should *not* conditionalize on Vinhibit_quit, or
- critical-quit (Control-Shift-G) won't work right. */
-
- /* WARNING: Even calling check_quit(), without actually dispatching
- a quit signal, can result in arbitrary Lisp code getting executed
- -- at least under Windows. (Not to mention obvious Lisp
- invocations like asynchronous timer callbacks.) Here's a sample
- stack trace to demonstrate:
-
- NTDLL! DbgBreakPoint@0 address 0x77f9eea9
-assert_failed(const char * 0x012d036c, int 4596, const char * 0x012d0354) line 3478
-re_match_2_internal(re_pattern_buffer * 0x012d6780, const unsigned char * 0x00000000, int 0, const unsigned char * 0x022f9328, int 34, int 0, re_registers * 0x012d53d0 search_regs, int 34) line 4596 + 41 bytes
-re_search_2(re_pattern_buffer * 0x012d6780, const char * 0x00000000, int 0, const char * 0x022f9328, int 34, int 0, int 34, re_registers * 0x012d53d0 search_regs, int 34) line 4269 + 37 bytes
-re_search(re_pattern_buffer * 0x012d6780, const char * 0x022f9328, int 34, int 0, int 34, re_registers * 0x012d53d0 search_regs) line 4031 + 37 bytes
-string_match_1(long 31222628, long 30282164, long 28377092, buffer * 0x022fde00, int 0) line 413 + 69 bytes
-Fstring_match(long 31222628, long 30282164, long 28377092, long 28377092) line 436 + 34 bytes
-Ffuncall(int 3, long * 0x008297f8) line 3488 + 168 bytes
-execute_optimized_program(const unsigned char * 0x020ddc50, int 6, long * 0x020ddf50) line 744 + 16 bytes
-funcall_compiled_function(long 34407748, int 1, long * 0x00829aec) line 516 + 53 bytes
-Ffuncall(int 2, long * 0x00829ae8) line 3523 + 17 bytes
-execute_optimized_program(const unsigned char * 0x020ddc90, int 4, long * 0x020ddf90) line 744 + 16 bytes
-funcall_compiled_function(long 34407720, int 1, long * 0x00829e28) line 516 + 53 bytes
-Ffuncall(int 2, long * 0x00829e24) line 3523 + 17 bytes
-mapcar1(long 15, long * 0x00829e48, long 34447820, long 34187868) line 2929 + 11 bytes
-Fmapcar(long 34447820, long 34187868) line 3035 + 21 bytes
-Ffuncall(int 3, long * 0x00829f20) line 3488 + 93 bytes
-execute_optimized_program(const unsigned char * 0x020c2b70, int 7, long * 0x020dd010) line 744 + 16 bytes
-funcall_compiled_function(long 34407580, int 2, long * 0x0082a210) line 516 + 53 bytes
-Ffuncall(int 3, long * 0x0082a20c) line 3523 + 17 bytes
-execute_optimized_program(const unsigned char * 0x020cf810, int 6, long * 0x020cfb10) line 744 + 16 bytes
-funcall_compiled_function(long 34407524, int 0, long * 0x0082a580) line 516 + 53 bytes
-Ffuncall(int 1, long * 0x0082a57c) line 3523 + 17 bytes
-run_hook_with_args_in_buffer(buffer * 0x022fde00, int 1, long * 0x0082a57c, int 0) line 3980 + 13 bytes
-run_hook_with_args(int 1, long * 0x0082a57c, int 0) line 3993 + 23 bytes
-Frun_hooks(int 1, long * 0x0082a57c) line 3847 + 19 bytes
-run_hook(long 34447484) line 4094 + 11 bytes
-unsafe_handle_wm_initmenu_1(frame * 0x01dbb000) line 736 + 11 bytes
-unsafe_handle_wm_initmenu(long 28377092) line 807 + 11 bytes
-condition_case_1(long 28377116, long (long)* 0x0101c827 unsafe_handle_wm_initmenu(long), long 28377092, long (long, long)* 0x01005fa4 mswindows_modal_loop_error_handler(long, long), long 28377092) line 1692 + 7 bytes
-mswindows_protect_modal_loop(long (long)* 0x0101c827 unsafe_handle_wm_initmenu(long), long 28377092) line 1194 + 32 bytes
-mswindows_handle_wm_initmenu(HMENU__ * 0x00010199, frame * 0x01dbb000) line 826 + 17 bytes
-mswindows_wnd_proc(HWND__ * 0x000501da, unsigned int 278, unsigned int 65945, long 0) line 3089 + 31 bytes
-USER32! UserCallWinProc@20 + 24 bytes
-USER32! DispatchClientMessage@20 + 47 bytes
-USER32! __fnDWORD@4 + 34 bytes
-NTDLL! KiUserCallbackDispatcher@12 + 19 bytes
-USER32! DispatchClientMessage@20 address 0x77e163cc
-USER32! DefWindowProcW@16 + 34 bytes
-qxeDefWindowProc(HWND__ * 0x000501da, unsigned int 274, unsigned int 61696, long 98) line 1188 + 22 bytes
-mswindows_wnd_proc(HWND__ * 0x000501da, unsigned int 274, unsigned int 61696, long 98) line 3362 + 21 bytes
-USER32! UserCallWinProc@20 + 24 bytes
-USER32! DispatchClientMessage@20 + 47 bytes
-USER32! __fnDWORD@4 + 34 bytes
-NTDLL! KiUserCallbackDispatcher@12 + 19 bytes
-USER32! DispatchClientMessage@20 address 0x77e163cc
-USER32! DefWindowProcW@16 + 34 bytes
-qxeDefWindowProc(HWND__ * 0x000501da, unsigned int 262, unsigned int 98, long 540016641) line 1188 + 22 bytes
-mswindows_wnd_proc(HWND__ * 0x000501da, unsigned int 262, unsigned int 98, long 540016641) line 3362 + 21 bytes
-USER32! UserCallWinProc@20 + 24 bytes
-USER32! DispatchMessageWorker@8 + 244 bytes
-USER32! DispatchMessageW@4 + 11 bytes
-qxeDispatchMessage(const tagMSG * 0x0082c684 {msg=0x00000106 wp=0x00000062 lp=0x20300001}) line 989 + 10 bytes
-mswindows_drain_windows_queue() line 1345 + 9 bytes
-emacs_mswindows_quit_p() line 3947
-event_stream_quit_p() line 666
-check_quit() line 686
-check_what_happened() line 437
-re_match_2_internal(re_pattern_buffer * 0x012d5a18, const unsigned char * 0x00000000, int 0, const unsigned char * 0x02235000, int 23486, int 14645, re_registers * 0x012d53d0 search_regs, int 23486) line 4717 + 14 bytes
-re_search_2(re_pattern_buffer * 0x012d5a18, const char * 0x02235000, int 23486, const char * 0x0223b38e, int 0, int 14645, int 8841, re_registers * 0x012d53d0 search_regs, int 23486) line 4269 + 37 bytes
-search_buffer(buffer * 0x022fde00, long 29077572, long 13789, long 23487, long 1, int 1, long 28377092, long 28377092, int 0) line 1224 + 89 bytes
-search_command(long 29077572, long 46975, long 28377116, long 28377092, long 28377092, int 1, int 1, int 0) line 1054 + 151 bytes
-Fre_search_forward(long 29077572, long 46975, long 28377116, long 28377092, long 28377092) line 2147 + 31 bytes
-Ffuncall(int 4, long * 0x0082ceb0) line 3488 + 216 bytes
-execute_optimized_program(const unsigned char * 0x02047810, int 13, long * 0x02080c10) line 744 + 16 bytes
-funcall_compiled_function(long 34187208, int 3, long * 0x0082d1b8) line 516 + 53 bytes
-Ffuncall(int 4, long * 0x0082d1b4) line 3523 + 17 bytes
-execute_optimized_program(const unsigned char * 0x01e96a10, int 6, long * 0x020ae510) line 744 + 16 bytes
-funcall_compiled_function(long 34186676, int 3, long * 0x0082d4a0) line 516 + 53 bytes
-Ffuncall(int 4, long * 0x0082d49c) line 3523 + 17 bytes
-execute_optimized_program(const unsigned char * 0x02156b50, int 4, long * 0x020c2db0) line 744 + 16 bytes
-funcall_compiled_function(long 34186564, int 2, long * 0x0082d780) line 516 + 53 bytes
-Ffuncall(int 3, long * 0x0082d77c) line 3523 + 17 bytes
-execute_optimized_program(const unsigned char * 0x0082d964, int 3, long * 0x020c2d70) line 744 + 16 bytes
-Fbyte_code(long 29405156, long 34352480, long 7) line 2392 + 38 bytes
-Feval(long 34354440) line 3290 + 187 bytes
-condition_case_1(long 34354572, long (long)* 0x01087232 Feval(long), long 34354440, long (long, long)* 0x01084764 run_condition_case_handlers(long, long), long 28377092) line 1692 + 7 bytes
-condition_case_3(long 34354440, long 28377092, long 34354572) line 1779 + 27 bytes
-execute_rare_opcode(long * 0x0082dc7c, const unsigned char * 0x01b090af, int 143) line 1269 + 19 bytes
-execute_optimized_program(const unsigned char * 0x01b09090, int 6, long * 0x020ae590) line 654 + 17 bytes
-funcall_compiled_function(long 34186620, int 0, long * 0x0082df68) line 516 + 53 bytes
-Ffuncall(int 1, long * 0x0082df64) line 3523 + 17 bytes
-execute_optimized_program(const unsigned char * 0x02195470, int 1, long * 0x020c2df0) line 744 + 16 bytes
-funcall_compiled_function(long 34186508, int 0, long * 0x0082e23c) line 516 + 53 bytes
-Ffuncall(int 1, long * 0x0082e238) line 3523 + 17 bytes
-execute_optimized_program(const unsigned char * 0x01e5d410, int 6, long * 0x0207d410) line 744 + 16 bytes
-funcall_compiled_function(long 34186312, int 1, long * 0x0082e524) line 516 + 53 bytes
-Ffuncall(int 2, long * 0x0082e520) line 3523 + 17 bytes
-execute_optimized_program(const unsigned char * 0x02108fb0, int 2, long * 0x020c2e30) line 744 + 16 bytes
-funcall_compiled_function(long 34186340, int 0, long * 0x0082e7fc) line 516 + 53 bytes
-Ffuncall(int 1, long * 0x0082e7f8) line 3523 + 17 bytes
-execute_optimized_program(const unsigned char * 0x020fe150, int 2, long * 0x01e6f510) line 744 + 16 bytes
-funcall_compiled_function(long 31008124, int 0, long * 0x0082ebd8) line 516 + 53 bytes
-Ffuncall(int 1, long * 0x0082ebd4) line 3523 + 17 bytes
-run_hook_with_args_in_buffer(buffer * 0x022fde00, int 1, long * 0x0082ebd4, int 0) line 3980 + 13 bytes
-run_hook_with_args(int 1, long * 0x0082ebd4, int 0) line 3993 + 23 bytes
-Frun_hooks(int 1, long * 0x0082ebd4) line 3847 + 19 bytes
-Ffuncall(int 2, long * 0x0082ebd0) line 3509 + 14 bytes
-execute_optimized_program(const unsigned char * 0x01ef2210, int 5, long * 0x01da8e10) line 744 + 16 bytes
-funcall_compiled_function(long 31020440, int 2, long * 0x0082eeb8) line 516 + 53 bytes
-Ffuncall(int 3, long * 0x0082eeb4) line 3523 + 17 bytes
-execute_optimized_program(const unsigned char * 0x0082f09c, int 3, long * 0x01d89390) line 744 + 16 bytes
-Fbyte_code(long 31102388, long 30970752, long 7) line 2392 + 38 bytes
-Feval(long 31087568) line 3290 + 187 bytes
-condition_case_1(long 30961240, long (long)* 0x01087232 Feval(long), long 31087568, long (long, long)* 0x01084764 run_condition_case_handlers(long, long), long 28510180) line 1692 + 7 bytes
-condition_case_3(long 31087568, long 28510180, long 30961240) line 1779 + 27 bytes
-execute_rare_opcode(long * 0x0082f450, const unsigned char * 0x01ef23ec, int 143) line 1269 + 19 bytes
-execute_optimized_program(const unsigned char * 0x01ef2310, int 6, long * 0x01da8f10) line 654 + 17 bytes
-funcall_compiled_function(long 31020412, int 1, long * 0x0082f740) line 516 + 53 bytes
-Ffuncall(int 2, long * 0x0082f73c) line 3523 + 17 bytes
-execute_optimized_program(const unsigned char * 0x020fe650, int 3, long * 0x01d8c490) line 744 + 16 bytes
-funcall_compiled_function(long 31020020, int 2, long * 0x0082fa14) line 516 + 53 bytes
-Ffuncall(int 3, long * 0x0082fa10) line 3523 + 17 bytes
-Fcall_interactively(long 29685180, long 28377092, long 28377092) line 1008 + 22 bytes
-Fcommand_execute(long 29685180, long 28377092, long 28377092) line 2929 + 17 bytes
-execute_command_event(command_builder * 0x01be1900, long 36626492) line 4048 + 25 bytes
-Fdispatch_event(long 36626492) line 4341 + 70 bytes
-Fcommand_loop_1() line 582 + 9 bytes
-command_loop_1(long 28377092) line 495
-condition_case_1(long 28377188, long (long)* 0x01064fb9 command_loop_1(long), long 28377092, long (long, long)* 0x010649d0 cmd_error(long, long), long 28377092) line 1692 + 7 bytes
-command_loop_3() line 256 + 35 bytes
-command_loop_2(long 28377092) line 269
-internal_catch(long 28457612, long (long)* 0x01064b20 command_loop_2(long), long 28377092, int * volatile 0x00000000) line 1317 + 7 bytes
-initial_command_loop(long 28377092) line 305 + 25 bytes
-STACK_TRACE_EYE_CATCHER(int 1, char * * 0x01b63ff0, char * * 0x01ca5300, int 0) line 2501
-main(int 1, char * * 0x01b63ff0, char * * 0x01ca5300) line 2938
-XEMACS! mainCRTStartup + 180 bytes
-_start() line 171
-KERNEL32! BaseProcessStart@4 + 115547 bytes
-
-*/
int specdepth;
if (dont_check_for_quit)
@@ -860,10 +708,28 @@ KERNEL32! BaseProcessStart@4 + 115547 by
#ifdef ERROR_CHECK_TRAPPING_PROBLEMS
/* Since the code below can call Lisp, make sure that proper wrapping is
in place during redisplay. */
+#if 0
assert_with_message
(proper_redisplay_wrapping_in_place (),
"QUIT called from within redisplay without being properly wrapped");
-#endif
+#else
+ /* FUCKME! It looks like we cannot even check for QUIT, *EVER*, during
+ redisplay. Checking for quit can dispatch events, which can enter
+ redisplay recursively, which can trip on
+
+Fatal error: assertion failed, file c:\xemacs\build\src\redisplay.c, line 5532,
+!dy->locked
+
+Backtrace given in
+
+ (Info-goto-node "(internals)Nasty Bugs due to Reentrancy in Redisplay Structures handling QUIT")
+
+ */
+ assert_with_message
+ (!in_display,
+ "QUIT called from within redisplay without being properly wrapped");
+#endif /* 0 */
+#endif /* ERROR_CHECK_TRAPPING_PROBLEMS */
/* Since arbitrary Lisp code may be executed (e.g. through a menu
filter, see backtrace directly above), GC might happen,
Index: src/redisplay.h
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/redisplay.h,v
retrieving revision 1.21
diff -u -p -r1.21 redisplay.h
--- src/redisplay.h 2004/11/04 23:06:50 1.21
+++ src/redisplay.h 2005/01/26 10:31:56
@@ -1,7 +1,7 @@
/* Redisplay data structures.
Copyright (C) 1994, 1995 Board of Trustees, University of Illinois.
Copyright (C) 1996 Chuck Thompson.
- Copyright (C) 1995, 1996, 2002, 2003 Ben Wing.
+ Copyright (C) 1995, 1996, 2002, 2003, 2004 Ben Wing.
This file is part of XEmacs.
@@ -840,5 +840,7 @@ int enter_redisplay_critical_section (vo
void exit_redisplay_critical_section (int);
int enter_redisplay_critical_section_maybe (void);
void exit_redisplay_critical_section_maybe (int depth);
+int enter_redisplay_critical_section_if (Boolint from_outside);
+void exit_redisplay_critical_section_if (Boolint from_outside, int depth);
#endif /* INCLUDED_redisplay_h_ */