Mercurial > octave
changeset 22718:d9bec44ffaff stable
Fix segfault / invalid state when exiting via GUI due to race (bug #49515)
* interpreter.cc (octave::interpreter::clean_up_and_exit): Ensure that the
function never returns when exiting via octave_link::exit. After the exit
signal is sent over the octave_link, the interpreter state may be completely
invalidated.
author | Mike Miller <mtmiller@octave.org> |
---|---|
date | Wed, 02 Nov 2016 17:32:57 -0700 |
parents | c2f0e687471e |
children | 5654429b6d7e 766b0163b3b7 |
files | libinterp/corefcn/interpreter.cc |
diffstat | 1 files changed, 6 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/libinterp/corefcn/interpreter.cc Thu Nov 03 10:06:16 2016 -0700 +++ b/libinterp/corefcn/interpreter.cc Wed Nov 02 17:32:57 2016 -0700 @@ -1070,15 +1070,17 @@ else { // What should we do here? We might be called from some - // location other than the end of octave_execute_interpreter, + // location other than the end of octave::interpreter::execute // so it might not be safe to return. // We have nothing else to do at this point, and the // octave_link::exit function is supposed to take care of - // exiting for us. Assume that job won't take more than a - // day... + // exiting for us. Hang here forever so we never return. - octave_sleep (86400); // FIXME: really needed? + while (true) + { + octave_sleep (1); + } } } else