diff src/input.cc @ 7913:f46e73bcb85b

toplev.cc (main_loop): undo previous change; input.cc (get_debug_input): don't delete global_command here
author John W. Eaton <jwe@octave.org>
date Wed, 09 Jul 2008 18:03:10 -0400
parents 8018e10d2b87
children 0ef13e15319b
line wrap: on
line diff
--- a/src/input.cc	Wed Jul 09 16:16:19 2008 -0400
+++ b/src/input.cc	Wed Jul 09 18:03:10 2008 -0400
@@ -631,24 +631,28 @@
       // This is the same as yyparse in parse.y.
       int retval = octave_parse ();
 
-      tree_statement_list *command = global_command;
+      if (retval == 0 && global_command)
+	{
+	  global_command->eval ();
+
+	  // FIXME -- To avoid a memory leak, global_command should be
+	  // deleted, I think.  But doing that here causes trouble if
+	  // an error occurs while executing a debugging command
+	  // (dbstep, for example). It's not clear to me why that
+	  // happens.
+	  //
+	  // delete global_command;
+	  //
+	  // global_command = 0;
+
+	  if (octave_completion_matches_called)
+	    octave_completion_matches_called = false;	    
+	}
 
       // Restore previous value of global_command.
       unwind_protect::run ();
 
-      if (retval == 0 && command)
-	{
-	  command->eval ();
-
-	  delete command;
-
-	  command = 0;
-
-	  OCTAVE_QUIT;
-
-	  if (octave_completion_matches_called)
-	    octave_completion_matches_called = false;	    
-	}
+      OCTAVE_QUIT;
     }
 
   unwind_protect::run_frame ("get_debug_input");