Branch: Tag:

2007-07-04

2007-07-04 17:35:42 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Don't pop the stack before the onerrors have run; they might need items from the stack.
Fixes issue with recovery in `+= with dmalloc.

Rev: src/error.c:1.150

2:   || This file is part of Pike. For copyright information see COPYRIGHT.   || Pike is distributed under GPL, LGPL and MPL. See the file COPYING   || for more information. - || $Id: error.c,v 1.149 2007/06/16 23:52:52 mast Exp $ + || $Id: error.c,v 1.150 2007/07/04 17:35:42 grubba Exp $   */      #define NO_PIKE_SHORTHAND
133:    if(!Pike_interpreter.recoveries)    Pike_fatal("No error recovery context.\n");    - #ifdef PIKE_DEBUG -  if(Pike_sp - Pike_interpreter.evaluator_stack < Pike_interpreter.recoveries->stack_pointer) -  Pike_fatal("Stack error in error.\n"); - #endif -  +     while(Pike_fp != Pike_interpreter.recoveries->frame_pointer)    {   #ifdef PIKE_DEBUG
147:    POP_PIKE_FRAME();    }    -  pop_n_elems(Pike_sp - Pike_interpreter.evaluator_stack - Pike_interpreter.recoveries->stack_pointer); -  Pike_mark_sp = Pike_interpreter.mark_stack + Pike_interpreter.recoveries->mark_sp; +  /* Don't pop the stack before the onerrors have run; they might need +  * items from the stack. +  */       while(Pike_interpreter.recoveries->onerror)    {
156:    Pike_interpreter.recoveries->onerror=Pike_interpreter.recoveries->onerror->previous;    }    + #ifdef PIKE_DEBUG +  if(Pike_sp - Pike_interpreter.evaluator_stack < Pike_interpreter.recoveries->stack_pointer) +  Pike_fatal("Stack error in error.\n"); + #endif +  +  pop_n_elems(Pike_sp - Pike_interpreter.evaluator_stack - Pike_interpreter.recoveries->stack_pointer); +  Pike_mark_sp = Pike_interpreter.mark_stack + Pike_interpreter.recoveries->mark_sp; +    #if defined(DEBUG_MALLOC) && defined(PIKE_DEBUG)    /* This will tell us where the value was caught (I hope) */    if(throw_value.type <= MAX_REF_TYPE)