octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: uimenu implementation, 2nd version [octave_execution_exception]


From: Ben Abbott
Subject: Re: uimenu implementation, 2nd version [octave_execution_exception]
Date: Sun, 21 Nov 2010 11:11:53 -0500

On Nov 20, 2010, at 8:47 PM, Ben Abbott wrote:

> On Nov 20, 2010, at 2:18 PM, Kai Habel wrote:
> 
>> On 18.11.2010 15:38, Ben Abbott wrote:
>>> On Nov 18, 2010, at 9:31 AM, Ben Abbott wrote:
>>> 
>>>> On Nov 18, 2010, at 9:18 AM, Ben Abbott wrote:
>>>> 
>>>>> On Nov 10, 2010, at 4:14 PM, Kai Habel wrote:
>>>>> 
>>>>>> On 27.10.2010 01:11, Ben Abbott wrote:
>>>>>>> On Oct 21, 2010, at 10:56 PM, Kai Habel wrote:
>>>>>>> 
>>>>>>>> Hello,
>>>>>>>> 
>>>>>>>> this is the second version of an uimenu implementation for the fltk 
>>>>>>>> backend. It should be compatible with matlab in most cases. My first 
>>>>>>>> implementation was more or less a proof-of-concept, this one is more 
>>>>>>>> careful designed. (I don't claim to be good C++ programmer, so if you 
>>>>>>>> think something should be done differently, I am open for suggestions)
>>>>>>>> This time I have separated the uimenu functions from the plot_window 
>>>>>>>> in a different class. Keep in mind that not all menu properties in 
>>>>>>>> fltk can be changed dynamically, therefore I have to rebuild the 
>>>>>>>> entrire menu in some cases.
>>>>>>>> I have attached a Changeset relative to the current tip. Changelog, 
>>>>>>>> News entry and manual entry are not included yet.
>>>>>>>> 
>>>>>>>> Since I have seen some crashes in intermediate versions, it would be 
>>>>>>>> nice if people regularly bulding octave on Mac and Windows could test 
>>>>>>>> the changeset. I have attached a simple test file as well.
>>>>>>>> 
>>>>>>>> Kai
>>>>>>>> 
>>>>>>>> Please not that there is already a bug opened for the delayed output 
>>>>>>>> of a callback function.
>>>>>>>> https://savannah.gnu.org/bugs/?31121
>>>>>>>> <simple_menu.m><Changeset.uimenu_ver2>
>>>>>>> This simple demo crashes octave.
>>>>>>> 
>>>>>>> figure (1)
>>>>>>> clf
>>>>>>> plot (1:10)
>>>>>>> f = uimenu ("label", "foobar");
>>>>>>> uimenu (f, "label", "Say Hello", "Callback", "disp ('Hello World')");
>>>>>>> uimenu (f, "label", "Clear Figure", "Callback", @clf);
>>>>>>> 
>>>>>>> The first menu item illustrates the problem with the delayed output.
>>>>>>> 
>>>>>>> Clicking on "Clear Figure", causes a core-dump
>>>>>>> 
>>>>>>> octave:1>   backend_fltk
>>>>>>> error: `backend_fltk' undefined near line 1 column 1
>>>>>>> octave:1>   backend fltk
>>>>>>> octave:2>   demo_uimenu
>>>>>>> octave:3>   error: Invalid call to clf.  Correct usage is:
>>>>>>> 
>>>>>>> -- Function File:  clf ()
>>>>>>> -- Function File:  clf ("reset")
>>>>>>> -- Function File:  clf (HFIG)
>>>>>>> -- Function File:  clf (HFIG, "reset")
>>>>>>> 
>>>>>>> 
>>>>>>> Additional help for built-in functions and operators is
>>>>>>> available in the on-line version of the manual.  Use the command
>>>>>>> `doc<topic>' to search the manual index.
>>>>>>> 
>>>>>>> Help and information about Octave is also available on the WWW
>>>>>>> at http://www.octave.org and via the address@hidden
>>>>>>> mailing list.
>>>>>>> terminate called after throwing an instance of 
>>>>>>> 'octave_execution_exception'
>>>>>>> panic: Abort trap -- stopping myself...
>>>>>>> attempting to save variables to `octave-core'...
>>>>>>> save to `octave-core' complete
>>>>>>> 
>>>>>>> A backtrace gives ...
>>>>>>> 
>>>>>>> #0  0x96a42ef6 in __kill ()
>>>>>>> #1  0x96a42ee8 in kill$UNIX2003 ()
>>>>>>> #2  0x96ad562d in raise ()
>>>>>>> #3  0x96aeb6e4 in abort ()
>>>>>>> #4  0x903bffda in __gnu_cxx::__verbose_terminate_handler ()
>>>>>>> #5  0x903be17a in __cxxabiv1::__terminate ()
>>>>>>> #6  0x903be1ba in std::terminate ()
>>>>>>> #7  0x903be2b8 in __cxa_throw ()
>>>>>>> #8  0x02532e2f in octave_throw_execution_exception () at misc/quit.cc:67
>>>>>>> #9  0x003b83f4 in lo_error_with_id_handler (id=Could not find the frame 
>>>>>>> base for "lo_error_with_id_handler(char const*, char const*, ...)".
>>>>>>> ) at octave.cc:546
>>>>>>> #10 0x01346046 in gripe_index_out_of_range (nd=2, dim=1, idx=1, ext=0) 
>>>>>>> at lo-array-gripes.cc:105
>>>>>>> #11 0x01403a23 in idx_vector::extent () at 
>>>>>>> /Users/bpabbott/Development/mercurial/local_clone/liboctave/idx-vector.h:779
>>>>>>> #12 0x01403a23 in Array<double>::index (this=0xbfff85e8, 
>>>>>>> address@hidden, address@hidden) at Array.cc:780
>>>>>>> #13 0x017b67ea in Matrix::extract_n (this=0xbfff85e8, r1=0, c1=2, nr=1, 
>>>>>>> nc=2) at dMatrix.cc:589
>>>>>>> #14 0x001ccadd in screen_size_pixels () at graphics.cc:541
>>>>>>> #15 0x0020cb9d in figure::properties::get_boundingbox (this=0x3080e08) 
>>>>>>> at graphics.cc:2765
>>>>>>> #16 0x00210716 in axes::properties::get_boundingbox (this=0x30a4c08, 
>>>>>>> internal=true) at graphics.cc:3962
>>>>>>> #17 0x047142e3 in plot_window::pixel2axes_or_ca (this=0x19123970, 
>>>>>>> px=35, py=52) at DLD-FUNCTIONS/fltk_backend.cc:988
>>>>>>> #18 0x0471a606 in plot_window::handle (this=0x19123970, event=1) at 
>>>>>>> DLD-FUNCTIONS/fltk_backend.cc:1223
>>>>>>> #19 0x027eb702 in send ()
>>>>>>> #20 0x027eeece in Fl::handle ()
>>>>>>> #21 0x027f123f in carbonMouseHandler ()
>>>>>>> #22 0x9613ff2f in DispatchEventToHandlers ()
>>>>>>> #23 0x9613f1f6 in SendEventToEventTargetInternal ()
>>>>>>> #24 0x961619bb in SendEventToEventTarget ()
>>>>>>> #25 0x961734db in ToolboxEventDispatcherHandler ()
>>>>>>> #26 0x96140380 in DispatchEventToHandlers ()
>>>>>>> #27 0x9613f1f6 in SendEventToEventTargetInternal ()
>>>>>>> #28 0x961ac441 in CallNextEventHandler ()
>>>>>>> #29 0x027ee022 in carbonDispatchHandler ()
>>>>>>> #30 0x9613ff2f in DispatchEventToHandlers ()
>>>>>>> #31 0x9613f1f6 in SendEventToEventTargetInternal ()
>>>>>>> #32 0x961619bb in SendEventToEventTarget ()
>>>>>>> #33 0x027edb22 in do_queued_events ()
>>>>>>> #34 0x027edccd in Fl::wait ()
>>>>>>> #35 0x027edd07 in Fl::check ()
>>>>>>> #36 0x04702bbf in __fltk_redraw__ () at 
>>>>>>> DLD-FUNCTIONS/fltk_backend.cc:1743
>>>>>>> #37 0x04702c25 in F__fltk_redraw__ () at 
>>>>>>> DLD-FUNCTIONS/fltk_backend.cc:1876
>>>>>>> #38 0x004a3d26 in octave_builtin::do_multi_index_op (this=0x48465e0, 
>>>>>>> nargout=0, address@hidden, lvalue_list=0x0) at ov-builtin.cc:129
>>>>>>> #39 0x004a40ff in octave_builtin::do_multi_index_op (this=0x48465e0, 
>>>>>>> nargout=0, address@hidden) at ov-builtin.cc:99
>>>>>>> #40 0x00080206 in octave_value::do_multi_index_op (this=0xbfff9e68, 
>>>>>>> nargout=0, address@hidden) at ov.cc:1267
>>>>>>> #41 0x00060c01 in feval (address@hidden, address@hidden, nargout=0) at 
>>>>>>> oct-parse.yy:4130
>>>>>>> #42 0x002ab4a6 in input_event_hook () at input.cc:1262
>>>>>>> #43 0x01ca2633 in command_editor::event_handler () at cmd-edit.cc:889
>>>>>>> #44 0x02bb85ec in rl_read_key ()
>>>>>>> #45 0x02ba09f8 in readline_internal_char ()
>>>>>>> #46 0x02ba0bc4 in readline_internal_charloop ()
>>>>>>> #47 0x02ba0bec in readline_internal ()
>>>>>>> #48 0x02ba06ac in readline ()
>>>>>>> #49 0x01ca376e in gnu_readline::do_readline (this=0x4037150, 
>>>>>>> address@hidden, address@hidden) at cmd-edit.cc:253
>>>>>>> #50 0x01ca3669 in command_editor::readline (address@hidden, 
>>>>>>> address@hidden) at cmd-edit.cc:914
>>>>>>> #51 0x0003bb63 in gnu_readline (address@hidden, force_readline=false) 
>>>>>>> at input.cc:205
>>>>>>> #52 0x0003d9ed in interactive_input (address@hidden, 
>>>>>>> force_readline=<value temporarily unavailable, due to optimizations>) 
>>>>>>> at input.cc:251
>>>>>>> #53 0x0003dc12 in std::string::operator= () at 
>>>>>>> /usr/include/c++/4.2.1/bits/basic_string.h:281
>>>>>>> #54 0x0003dc12 in octave_gets [inlined] () at 
>>>>>>> /Users/bpabbott/Development/mercurial/local_clone/src/input.cc:281
>>>>>>> #55 0x0003dc12 in get_user_input [inlined] () at 
>>>>>>> /Users/bpabbott/Development/mercurial/local_clone/src/input.cc:352
>>>>>>> #56 0x0003dc12 in octave_read (buf=0x49eca00 "", max_size=8192) at 
>>>>>>> input.cc:374
>>>>>>> #57 0x0003eebf in yy_get_next_buffer () at lex.cc:3098
>>>>>>> #58 0x0004fec9 in octave_lex () at lex.cc:2940
>>>>>>> #59 0x00066940 in octave_parse () at oct-parse.cc:2409
>>>>>>> #60 0x00424194 in main_loop () at toplev.cc:564
>>>>>>> #61 0x003bfc32 in octave_main (argc=6, argv=0xbfffafd8, embedded=0) at 
>>>>>>> octave.cc:894
>>>>>>> #62 0x00001f80 in main (argc=6, argv=0xbfffafd8) at main.c:35
>>>>>>> 
>>>>>>> Ben
>>>>>> Ben,
>>>>>> 
>>>>>> I have found some bugs in the uimenu code, could you check with a recent 
>>>>>> tip (including [1]), if you still get a crash. If you do, can you send 
>>>>>> me the output of valgrind too? (./run-octave -valgrind)
>>>>>> 
>>>>>> Kai
>>>>>> 
>>>>>> [1]
>>>>>> address@hidden:~/hg-octave/octave>  hg tip
>>>>>> Ă„nderung:        11224:e0db3f9e9267
>>>>>> Marke:           tip
>>>>>> Nutzer:          Kai Habel<address@hidden>
>>>>>> Datum:           Wed Nov 10 22:03:58 2010 +0100
>>>>>> Zusammenfassung: Add more checks for uimeu
>>>>> Kai,
>>>>> 
>>>>> I still see the crash.
>>>>> 
>>>>> Unfortunately, I don't have valgrind installed on MacOS X. I'll have to 
>>>>> dowload and build it. Once that is done, I'll reply with the results 
>>>>> attached.
>>>>> 
>>>>> Ben
>>>> With valgrind, it crashed while I was adding the uimenus. This time I had 
>>>> written a simple script. The crash occurred before figure was rendered.
>>>> 
>>>> Both the output and the script are attached.
>>>> 
>>>> Ben
>>>> 
>>>> 
>>>> <crash.txt><go.m>
>>> When I type the commands, I can see the crash occurs when I type 
>>> "plot(1:10)"
>> But this before you add the uimenu, or did you use another command sequence?
> 
> What I did was ...
> 
> figure (1)
> clf
> plot (1:10)
> f = uimenu ("label", "foobar");
> uimenu (f, "label", "Say Hello", "Callback", "disp ('Hello World')");
> uimenu (f, "label", "Clear Figure", "Callback", @clf)
> 
> However, today the only crash I see is when I select "Clear Figure". My build 
> process on MacOS X isn't reliable.  So please ignore the prior info.
> 
> Ben

A bit more detail. I wrote a simple script ...

------------- demo_uimenu.m -------------
backend fltk
hf = figure (1);
clf
plot (1:10)
hui = uimenu (hf, "label", "foobar");
callback = @ (h,dummy) error ("Call error()");
u = uimenu (hui, "label", "Throw error", "Callback", callback)
callback (u, []);
----------------------------------------------------

My thought was to test if I could trigger a core-dump outside the context of 
the uimenu. I could not, but I did find something unexpected.

octave:1> demo_uimenu
u = -8.3276
error: Call error()
error: called from:
error:   /Users/bpabbott/Development/Octave_Toolbox/Kai/demo_uimenu.m at line 
9, column 1
octave:1> delete (gca)
error: Call error()
error: called from:
error:    at line -1, column -1
error: set: invalid graphics handle for property "currentaxes"
error:   
/Users/bpabbott/Development/mercurial/local_clone/scripts/miscellaneous/delete.m
 at line 48, column 1

At this point Octave has *not* crashed. If I now selected the uimenu "Throw 
error" ....

octave:1> error: Call error()
error: called from:
error:    at line -1, column -1

I get the error, and Octave is still running. If I duplicated the same 
sequence, but without "delete(gca)", I get a core-dump.

octave:1> close all
octave:2> demo_uimenu
u = -1.0294
error: Call error()
error: called from:
error:   /Users/bpabbott/Development/Octave_Toolbox/Kai/demo_uimenu.m at line 
9, column 1
octave:2> error: Call error()
error: called from:
error:    at line -1, column -1
error: octave_base_value::matrix_value(): wrong type argument `<unknown type>'
error: __fltk_redraw__: A(I,J): row index out of bounds; value 1 out of bound 0
terminate called after throwing an instance of 'octave_execution_exception'
panic: Abort trap -- stopping myself...
attempting to save variables to `octave-core'...
save to `octave-core' complete

Ben








reply via email to

[Prev in Thread] Current Thread [Next in Thread]