# HG changeset patch # User John W. Eaton # Date 1215640990 14400 # Node ID f46e73bcb85b9d9f2ccf355eab5ded747875ea53 # Parent 75df1f0b4c9da9a130e655a0fb096b049bd4a494 toplev.cc (main_loop): undo previous change; input.cc (get_debug_input): don't delete global_command here diff -r 75df1f0b4c9d -r f46e73bcb85b src/ChangeLog --- a/src/ChangeLog Wed Jul 09 16:16:19 2008 -0400 +++ b/src/ChangeLog Wed Jul 09 18:03:10 2008 -0400 @@ -1,5 +1,8 @@ 2008-07-09 John W. Eaton + * input.cc (get_debug_input): Don't delete global_command here. + * toplev.cc (main_loop): Undo previous change. + * toplev.h (octave_call_stack::instance_ok): Push top scope when creating instance. diff -r 75df1f0b4c9d -r f46e73bcb85b src/input.cc --- 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"); diff -r 75df1f0b4c9d -r f46e73bcb85b src/toplev.cc --- a/src/toplev.cc Wed Jul 09 16:16:19 2008 -0400 +++ b/src/toplev.cc Wed Jul 09 18:03:10 2008 -0400 @@ -543,8 +543,6 @@ octave_initialized = true; - unwind_protect::begin_frame ("main_loop"); - // The big loop. int retval = 0; @@ -558,26 +556,18 @@ reset_parser (); - // Save current value of global_command. - unwind_protect_ptr (global_command); - // This is the same as yyparse in parse.y. retval = octave_parse (); - tree_statement_list *command = global_command; - - // Restore previous value of global_command. - unwind_protect::run (); - if (retval == 0) { - if (command) + if (global_command) { - command->eval (); + global_command->eval (); - delete command; + delete global_command; - command = 0; + global_command = 0; OCTAVE_QUIT; @@ -632,8 +622,6 @@ } while (retval == 0); - unwind_protect::run_frame ("main_loop"); - return retval; }