bugGNU Octave - Bugs: bug #43664, ginput() freezes upon...

 
 

bug #43664: ginput() freezes upon double-clicking in a fltk figure

Submitter:  None
Submitted:  Fri 21 Nov 2014 04:04:15 PM UTC
   
 
Category:  None Severity:  3 - Normal
Priority:  5 - Normal Item Group:  None
Status:  Fixed Assigned to:  None
Originator Name:  Adrian Originator Email:  -email is unavailable-
Open/Closed:  * Closed Release:  * 3.8.2
Operating System:  * GNU/Linux Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Tue 02 Dec 2014 10:34:01 AM UTC, comment #5: 

Fixed with cset 3492b771c2e6 (http://hg.savannah.gnu.org/hgweb/octave/rev/3492b771c2e6)

A friend tried the behavior in Matlab and they also count double-clicks as two separate clicks.

Closing bugreport as fixed.

Andreas Weber <andy1978>
Group Member
Sun 23 Nov 2014 11:56:06 AM UTC, comment #4: 

On the default branch you could check the figure property "selectiontype" which is "open" for double-click events. (implemented with cset 7f73293d8423)

Unfortunally you have to wait for the 4.2 release until this gets stable.

Andreas Weber <andy1978>
Group Member
Sat 22 Nov 2014 11:40:26 AM UTC, comment #3: 

Thanks a lot, the patch squashes the bug indeed.

Note however that it now becomes quite impossible to distinguish a simple from a double-click, and that information is lost. I'd advocate keeping only the first line of your patch, and explicitly say in the function doc that the returned array may contain more entries than requested, in case of very fast clicks (e.g. double-clicks).

Another solution would be to have ginput remember the additional click for the next call on the same window. This is not very satisfying though, because it is still impossible for a script to find out whether a double-click happened: it would require a non-blocking or timed-out second call to ginput(1), which does not exist.

I'll try to find out how Matlab behaves in this regard.

Adrian <adaerr>
Fri 21 Nov 2014 05:25:32 PM UTC, comment #2: 

Patch attached, can this go to stable or should this go to default?
I think it would be also interesting how Matlab behaves on double-click.

(file #32518)

Andreas Weber <andy1978>
Group Member
Fri 21 Nov 2014 04:48:03 PM UTC, comment #1: 

I can confirm this with 3.8.2 and on the default branch (although it's much harder to reproduuce on default).

The reason on stable is, that in _fttk_ginput_.m, line 51

  [x, y, n0, button] = ginput_accumulator (-1, 0, 0, 0)
  until (n0 == n || n0 < 0)


waits until n0 matches exactly the number of requested clicks but if the user is very fast and double clicks, n0 get 2 and the loop doesn't get aborted. A solution would be to change this to


  until (n0 >= n || n0 < 0)


and remove the surplus entries in x,y and button. Can someone test how Matlab behaves on double clicks in ginput?

Andreas Weber <andy1978>
Group Member
Fri 21 Nov 2014 04:04:15 PM UTC, original submission:  

On my computer the bug can be reliably reproduced by the following few instructions in a fresh interactive session:

# display a large image, then invoque ginput:
a=0:2000;
imagesc(a'*a)
ginput(1)

and then double-clicking inside the Figure window. Normally (such as for a normal plot() window or if I replace 2000 by a small number such as 20 in the instructions above) the function ginput(1) will return upon the double-click. In the above example however the function does not return, and appears to have frozen: it does not return even upon subsequent clicks (simple left or right click) into the Figure window. The function has to be interrupted by pressing Ctrl-C.

The expected behaviour would at least be not to freeze, and either return immediately or on the next click.
Because double-clicking in a fltk Figure window has a special effect (causing an autoscale), I feel that ginput() should not react at all to it (lest there be a way to tell the double-click from a simple click, so we know what is a mere change of the zoom level and what is real input). But that's another debate, the bug report here is about the freezing.

System details:
GNU/Linux Debian mixed stable/testing
octave is configured to use fltk as graphics_toolkit
(using graphics_toolkit("gnuplot") the bug disappears, that is ginput(1) returns upon double-click, but here the double-click also does not have the special effect of causing an autoscale as in the fltk window)

Anonymous

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #32518:  bug_43664_ginput.diff added by andy1978 (671B - 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 adaerr (Posted a comment)
  • -email is unavailable- added by andy1978 (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 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2014-12-02 andy1978 StatusPatch Submitted Fixed
        Open/ClosedOpen Closed
    2014-11-21 andy1978 Attached File- Added bug_43664_ginput.diff, #32518
        StatusConfirmed Patch Submitted
    2014-11-21 andy1978 StatusNone Confirmed

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code