bugGNU Octave - Bugs: bug #51161, Issues with GUI object callback...

 
 

bug #51161: Issues with GUI object callback functions

Submitter:  None
Submitted:  Fri 02 Jun 2017 12:46:57 PM UTC
   
 
Category:  Plotting Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Unexpected Error or Warning
Status:  Need Info Assigned to:  None
Originator Name:  David Foxall Originator Email:  -email is unavailable-
Open/Closed:  * Closed Release:  * 4.0.3
Operating System:  * Microsoft Windows Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Mon 12 Jun 2017 06:42:08 AM UTC, comment #2: 

Closing report since not futher information was provided.

Pantxo Diribarne <pantxo>
Group Member
Sun 04 Jun 2017 12:57:07 PM UTC, comment #1: 

Hi,

Graphics callbacks support any kind of data, just don't forget that the two first arguments to a callback are provided by the graphics system: arg 1 is the handle to the object that triggered the callback execution, arg 2 contains event data that depend on the situation (empty most of the time); see https://www.gnu.org/software/octave/doc/interpreter/Callbacks.html#Callbacks and the following example:


fcn = @(h, ev, arg1, arg2) printf ("\nhandle: %f\nevent data: %s\narg1: %s\narg2: %s", h, disp (ev), disp (arg1), disp (arg2));
a = {"a", 2};
b = struct ("a", 1, "b", ones (1, 3));
figure ()
uimenu ("label", "foo", "callback", {fcn, a, b})


Your xv_roi_update misses the event argument.

Now about the crash you report when using a script as a callback function (which is an error but should not crash Octave), can you give simple example that triggers the crash for you.

Pantxo Diribarne <pantxo>
Group Member
Fri 02 Jun 2017 12:46:57 PM UTC, original submission:  

I have been trying to implement a GUI for image analysis. My program has a uicontrol listbox object and I originally wrote a callback to accept three structures: one with object handles, one with the image data and one with ROI data. 

Manipulating the GUI to execute the callback caused OCTAVE to report an error about attempting to dereference a scalar with a period.

OK it didn't support structures ... so I tried to pass an array and dereference an element inside the callback. To get the following message.

error: xv_roi_update: A(I): index out of bounds; value 1 out of bound 0
error: called from
    xv_roi_update at line 16 column 10

It seems that OCTAVE only supports passing scalar variables to callbacks.

So I tried a simple script as the callback, and on triggering it, crashed the whole program.

The attached files should reproduce the problem if you alter test.m to supply some of your own image data.

Anonymous

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #40840:  xv.m added by None (10KiB - application/octet-stream - You will have to supply an image to run these scripts )
file #40841:  xv_display.m added by None (279B - application/octet-stream - You will have to supply an image to run these scripts )
file #40842:  xv_roi_update.m added by None (500B - application/octet-stream - You will have to supply an image to run these scripts )
file #40843:  test.m added by None (174B - application/octet-stream - You will have to supply an image to run these scripts )

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by pantxo (Posted a comment)
  • -email is unavailable- added by None (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 7 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2017-06-12 pantxo Open/ClosedOpen Closed
    2017-06-04 pantxo CategoryGUI Plotting
        StatusNone Need Info
    2017-06-02 None Attached File- Added xv.m, #40840
        Attached File- Added xv_display.m, #40841
        Attached File- Added xv_roi_update.m, #40842
        Attached File- Added test.m, #40843

    Back to the top

    Powered by Savane 3.13-caa5.
    Corresponding source code