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: Wed, 27 Oct 2010 15:56:46 +0800

On Oct 27, 2010, at 3:10 PM, Kai Habel wrote:

> -------- Original-Nachricht --------
>> Datum: Wed, 27 Oct 2010 07:11:24 +0800
>> Von: Ben Abbott <address@hidden>
>> An: Kai Habel <address@hidden>
>> CC: GNU Octave <address@hidden>
>> Betreff: Re: uimenu implementation, 2nd version [octave_execution_exception]
> 
>> 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,
> 
> do you get the crash also when you change the 2nd callback to "gcf".

Works as expected with "gcf" ... I'd forgotten that two args are passed to the 
callback function.

> You cannot use a function handle in this case, because for function handles 
> two default arguments (one is the calling object, the other is ... have to 
> look it up) are being passed to the callback function. So, you can either use 
> a function string or you can write your own callback function e.g. @clf_cb.
> 
> e.g.
> function clf_cb(arg1,arg2)
>  arg1,arg2
>  clf;
> endfunction
> 
> Regarding the crash. First, I don't see this on linux. Second, I am not sure 
> if the failing clf still tries to clear all child objects of the figure. If 
> that is the case the attached patch could help. So, please give it a try.
> 
> Kai
> <patch.clf_cb>

The crash still occurs with the clf_cb path.

I tried adding debug statements to track down the location of the crash. The 
crash occurs during the call to "error (msg)" in print_usage.m

Ben



reply via email to

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