comparison src/eval.c @ 1313:671b65f2b075

[xemacs-hg @ 2003-02-20 01:12:25 by ben] patch for crashes when deleting frames eval.c: Don't check_quit() unless we're unbinding a real Lisp `unwind-protect' since check_quit() does lots of weird things and not all callers are prepared for it. frame.c: Make absolutely sure there is no quit checking while we are in a "critical section" during frame deletion.
author ben
date Thu, 20 Feb 2003 01:12:26 +0000
parents f3437b56874d
children b531bf8658e9
comparison
equal deleted inserted replaced
1312:22741407fc1f 1313:671b65f2b075
5928 /* Don't call this directly. 5928 /* Don't call this directly.
5929 Only for use by UNBIND_TO* macros in backtrace.h */ 5929 Only for use by UNBIND_TO* macros in backtrace.h */
5930 void 5930 void
5931 unbind_to_hairy (int count) 5931 unbind_to_hairy (int count)
5932 { 5932 {
5933 Lisp_Object oquit;
5934
5935 ++specpdl_ptr; 5933 ++specpdl_ptr;
5936 ++specpdl_depth_counter; 5934 ++specpdl_depth_counter;
5937 5935
5938 /* Allow QUIT within unwind-protect routines, but defer any existing QUIT
5939 until afterwards. */
5940 check_quit (); /* make Vquit_flag accurate */
5941 oquit = Vquit_flag;
5942 Vquit_flag = Qnil;
5943
5944 while (specpdl_depth_counter != count) 5936 while (specpdl_depth_counter != count)
5945 { 5937 {
5938 Lisp_Object oquit = Qunbound;
5939
5940 /* Do this check BEFORE decrementing the values below, because once
5941 they're decremented, GC protection is lost on
5942 specpdl_ptr->old_value. */
5943 if (specpdl_ptr->func == Fprogn)
5944 {
5945 /* Allow QUIT within unwind-protect routines, but defer any
5946 existing QUIT until afterwards. Only do this, however, for
5947 unwind-protects established by Lisp code, not by C code
5948 (e.g. free_opaque_ptr() or something), because the act of
5949 checking for QUIT can cause all sorts of weird things to
5950 happen, since it churns the event loop -- redisplay, running
5951 Lisp, etc. Code should not have to worry about this just
5952 because of establishing an unwind-protect. */
5953 check_quit (); /* make Vquit_flag accurate */
5954 oquit = Vquit_flag;
5955 Vquit_flag = Qnil;
5956 }
5957
5946 --specpdl_ptr; 5958 --specpdl_ptr;
5947 --specpdl_depth_counter; 5959 --specpdl_depth_counter;
5948 5960
5961 /* #### At this point, there is no GC protection on old_value. This
5962 could be a real problem, depending on what unwind-protect function
5963 is called. It looks like it just so happens that the ones
5964 actually called don't have a problem with this, e.g. Fprogn. But
5965 we should look into fixing this. (Many unwind-protect functions
5966 free values. Is it a problem if freed values are
5967 GC-protected?) */
5949 if (specpdl_ptr->func != 0) 5968 if (specpdl_ptr->func != 0)
5950 /* An unwind-protect */ 5969 {
5951 (*specpdl_ptr->func) (specpdl_ptr->old_value); 5970 /* An unwind-protect */
5971 (*specpdl_ptr->func) (specpdl_ptr->old_value);
5972 }
5973
5952 else 5974 else
5953 { 5975 {
5954 /* We checked symbol for validity when we specbound it, 5976 /* We checked symbol for validity when we specbound it,
5955 so only need to call Fset if symbol has magic value. */ 5977 so only need to call Fset if symbol has magic value. */
5956 Lisp_Symbol *sym = XSYMBOL (specpdl_ptr->symbol); 5978 Lisp_Symbol *sym = XSYMBOL (specpdl_ptr->symbol);
5977 catchlist = catchlist->next; 5999 catchlist = catchlist->next;
5978 /* Don't mess with gcprolist, backtrace_list here */ 6000 /* Don't mess with gcprolist, backtrace_list here */
5979 } 6001 }
5980 #endif 6002 #endif
5981 #endif 6003 #endif
5982 } 6004
5983 Vquit_flag = oquit; 6005 if (!UNBOUNDP (oquit))
6006 Vquit_flag = oquit;
6007 }
5984 check_specbind_stack_sanity (); 6008 check_specbind_stack_sanity ();
5985 } 6009 }
5986 6010
5987 6011
5988 6012