bugGNU Octave - Bugs: bug #48175, "parse error" error...

 
 

bug #48175: "parse error" error message in GUI callbacks

Submitted by:  Guillaume <gyom>
Submitted on:  Wed 08 Jun 2016 12:05:40 PM UTC  
 
Category:  Octave Function Severity:  1 - Wish
Priority:  4 Item Group:  Feature Request
Status:  Fixed Assigned to:  None
Originator Name:  Guillaume Open/Closed:  Closed
Release:  dev Operating System:  Any

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

( Jump to the original submission)

Sat 11 Jun 2016 01:41:02 AM UTC, comment #8:

Oops, I totally misread comment #2 and was thinking the error was the same before and after the callback executed. You had it right to begin with,

http://hg.savannah.gnu.org/hgweb/octave/rev/25b117822bfd

Mike Miller <mtmiller>
Project Administrator
Sat 11 Jun 2016 01:27:25 AM UTC, comment #7:

I'm not sure we care to be 100% compatible, but Matlab stores the message "Error while evaluating UIControl Callback" in the lasterror field. Wouldn't it be simpler not to save/restore the lasterror state? Or just leave it alone so it had the error message from inside the callback itself?

Rik <rik5>
Project Administrator
Sat 11 Jun 2016 12:40:24 AM UTC, comment #6:

Thanks for the idea. I changed this yet a little more by saving and restoring the last error structure to what it was before the callback was called,

http://hg.savannah.gnu.org/hgweb/octave/rev/0331d3e832e3

Mike Miller <mtmiller>
Project Administrator
Fri 10 Jun 2016 04:57:01 AM UTC, comment #5:

@Mike: Take a look at my newly uploaded diff. I fake the error message by writing to std::cerr and then set the internal error message by calling the Octave function lasterr().

Feel free to modify the message, or to commit the change.

(file #37442)

Rik <rik5>
Project Administrator
Thu 09 Jun 2016 06:11:41 PM UTC, comment #4:

Well the attached diff works for me, with both string and function handle callbacks in place. This definitely gets rid of the "parse error" message and only shows the intended callback message. But it still sets lasterror to the message originating in the callback. Some more tweaking will be necessary if it's also important that the global error state is not changed when the callback executes.

(file #37440)

Mike Miller <mtmiller>
Project Administrator
Thu 09 Jun 2016 05:30:19 PM UTC, comment #3:

Changing this report to a Feature Request and lowering the Severity and Priority. Octave behaves equivalently to Matlab, except the error message is less informative.

I don't know if it can be fixed, but the place to fix it will be in libinterp/corefcn/graphics.cc. The function in question is gh_manager::do_execute_callback(). If the callback is a string, then eval_string is called, if it is anything else then feval is called.

Interestingly, there are differences between eval_string and feval. The example in comment #0 used a string for the callback. The following code uses a function handle.

Just for grins, I put the feval in do_execute_callback inside a try/catch block.

And running now produces

It works to produce the new error message, but I also get a "parse error" message. This must be coming from the parser itself in parse-tree/oct-parse.cc

Rik <rik5>
Project Administrator
Thu 09 Jun 2016 10:57:16 AM UTC, comment #2:

Here is what happens with Matlab:

Guillaume <gyom>
Wed 08 Jun 2016 06:43:10 PM UTC, comment #1:

Confirmed here.

What does Matlab's lasterror function show after calling uicontrol but before actually clicking on the button? What does lasterror show after clicking on the button?

Mike Miller <mtmiller>
Project Administrator
Wed 08 Jun 2016 12:05:40 PM UTC, original submission:

When an error is thrown during the execution of a uicontrol callback (that does not contain any syntax error), a "parse error" error message is displayed:

It seems slightly misleading. In the same context, Matlab displays "Error while evaluating UIControl Callback".

Guillaume <gyom>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #37442:  bug_48175-2.diff added by rik5 (2KiB - application/x-download)
file #37440:  bug-48175.diff added by mtmiller (1010B - text/x-diff)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by mtmiller (Posted a comment)
  • -email is unavailable- added by gyom (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

     

     

    Follow 10 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2016-06-11 mtmiller StatusPatch Submitted => Fixed
        Open/ClosedOpen => Closed
    2016-06-10 rik5 Attached File- => Added bug_48175-2.diff, #37442
    2016-06-09 mtmiller Attached File- => Added bug-48175.diff, #37440
        CategoryGUI => Octave Function
        StatusNeed Info => Patch Submitted
    2016-06-09 rik5 Severity3 - Normal => 1 - Wish
        Priority5 - Normal => 4
        Item GroupNone => Feature Request
    2016-06-08 mtmiller StatusNone => Need Info

    Back to the top


    Powered by Savane 3.4