diff src/parse.y @ 7903:8018e10d2b87

save and restore global_command as needed
author John W. Eaton <jwe@octave.org>
date Wed, 09 Jul 2008 10:58:12 -0400
parents 3e4c9b69069d
children 0d607e8dbbfa
line wrap: on
line diff
--- a/src/parse.y	Tue Jul 08 14:22:08 2008 -0400
+++ b/src/parse.y	Wed Jul 09 10:58:12 2008 -0400
@@ -3719,8 +3719,6 @@
 
   current_eval_string = s;
 
-  unwind_protect_ptr (global_command);
-
   YY_BUFFER_STATE old_buf = current_buffer ();
   YY_BUFFER_STATE new_buf = create_buffer (0);
 
@@ -3733,10 +3731,15 @@
     {
       reset_parser ();
 
+      unwind_protect_ptr (global_command);
+
       parse_status = yyparse ();
 
       tree_statement_list *command = global_command;
 
+      // Restore previous value of global_command.
+      unwind_protect::run ();
+
       if (parse_status == 0)
         {
 	  if (command)