Sat 09 Oct 2010 08:14:53 PM UTC, comment #3:
After thinking about it some more, I doubt that the patch I posted is sufficient. What if a function registered with input_event_hook needs to be parsed (or, causes some other function to be parsed) when we are already parsing another function? I think that will cause trouble because Octave's parser is not reentrant. It would probably take some effort to make it so. The solution is probably to somehow avoid parsing another function simultanousely, but I'm not sure precisely how to go about doing that and still have input_event_hook working correctly so that it processes graphics events (for example).
|
Sat 09 Oct 2010 02:32:07 PM UTC, comment #1:
I assume you found this problem with the fltk backend? I think it will also happen if there are any input_event_hook functions defined. The problem is that input_event_hook in input.cc calls feval, and if that happens when we are in the middle of parsing a function, the current symbol table scope is pushed/popped, but the parser had it temporarily set to the scope of the partially parsed function. I'm not sure whether it is appropriate to push the scope of the new partially parsed function onto the call stack, but that appears to avoid the crash. See the attached patch. But since I'm not sure about this solution and it might cause some other trouble, I'd like some feedback before committing it.
(file #21646)
|
Sat 09 Oct 2010 12:59:45 PM UTC, original submission:
I have:
kai@linux-nuoy:~/hg-octave/octave> hg tip
Änderung: 11091:5677f3f7b5fa
Marke: tip
Nutzer: John W. Eaton <jwe@octave.org>
Datum: Fri Oct 08 15:22:47 2010 -0400
Zusammenfassung: Matlab compatible short-circuit behavior for & and | operators
When I call ./run-octave -g and try to paste the folling code:
function myfun
figure(1)
set(1,'windowbuttondownfcn','grid')
end
I get the following crash:
octave:1> function myfun
> figure(1)
> set(1,'windowbuttondownfcn','grid')
> end
octave: symtab.h:1837: static void symbol_table::set_curr_fcn(octave_user_function*, symbol_table::scope_id): Assertion `scope != xtop_scope && scope != xglobal_scope' failed.
Program received signal SIGABRT, Aborted.
0x00007ffff15039e5 in raise () from /lib64/libc.so.6
(gdb) bt
#0 0x00007ffff15039e5 in raise () from /lib64/libc.so.6
#1 0x00007ffff1504ee6 in abort () from /lib64/libc.so.6
#2 0x00007ffff14fc235 in __assert_fail () from /lib64/libc.so.6
#3 0x00007ffff751ecb6 in set_curr_fcn (this=0x6a9138, sid=1, pl=0x0, rl=0x0, cl=<value optimized out>) at symtab.h:1837
#4 octave_user_function::octave_user_function (this=0x6a9138, sid=1, pl=0x0, rl=0x0, cl=<value optimized out>)
at ov-usr-fcn.cc:193
#5 0x00007ffff72d72d4 in start_function (param_list=0x0, body=0xd01720, end_fcn_stmt=<value optimized out>)
at oct-parse.yy:2814
#6 0x00007ffff72e291c in octave_parse () at oct-parse.yy:1412
#7 0x00007ffff73c234c in main_loop () at toplev.cc:564
#8 0x00007ffff735ab0f in octave_main (argc=6, argv=<value optimized out>, embedded=0) at octave.cc:884
#9 0x00007ffff14efb7d in __libc_start_main () from /lib64/libc.so.6
#10 0x0000000000400739 in _start () at ../sysdeps/x86_64/elf/start.S:113
(gdb)
|