bugGNU Octave - Bugs: bug #37640, invalid handle in legend.m when...


bug #37640: invalid handle in legend.m when closing a figure

Submitted by:  Torsten Lilge <ttl>
Submitted on:  Sat 27 Oct 2012 11:04:56 AM UTC  
Category:  Plotting Severity:  4 - Important
Priority:  5 - Normal Item Group:  Segfault, Bus Error, etc.
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  Closed
Release:  dev Operating System:  GNU/Linux

Add a New Comment (Rich Markup)

You are not logged in

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


Tue 30 Oct 2012 07:39:56 PM UTC, comment #4: 

I fixed this on the stable branch here (http://hg.savannah.gnu.org/hgweb/octave/rev/3649a6012eaa) and also pulled the fix on to the development branch.  You will need to build from Mercurial sources in order to see the fix or wait until the next release.

Rik <rik5>
Project Administrator
Tue 30 Oct 2012 05:44:11 PM UTC, comment #3: 

AFAIK, 'r*;legend string;' is not a correct snytax for Matlab. The code to use instead is:

hold on;
h1 = plot(2,3,'r*');
h2 = plot(5,5,'bo');
legend('data 1','data 2');
close all;

Using the code above, the legend entry related to h1 is not deleted in Matlab, not in Octave with fltk, but in Octave with gnuplot. The error still occurs in Octave.

Torsten Lilge <ttl>
Project Member
Tue 30 Oct 2012 04:58:48 AM UTC, comment #2: 

I have a fix, but I wonder what Matlab is doing in this same case.  When the statement 'delete(h1)' is executed, does Matlab remove the legend entry as well as the plot data?  Or does it leave the legend displayed until the final 'close all'?

Rik <rik5>
Project Administrator
Tue 30 Oct 2012 04:33:35 AM UTC, comment #1: 

The bug is even worse than reported.  With the FLTK backend, clicking on the plot after 'close all' causes a segmentation fault.

Rik <rik5>
Project Administrator
Sat 27 Oct 2012 11:04:56 AM UTC, original submission:  

Closing a figure after having deleted a plot object with legend entry, the following error messages appear (with gnuplot and fltk):

error: get: invalid handle (= -33.2181)
error: evaluating argument list element number 1
error: called from:
error:   ..../octave/scripts/plot/legend.m at line 979, column 5
error: invalid graphics handle
error: invalid graphics handle
error: invalid graphics handle
error: invalid graphics handle
error: invalid graphics handle
error:   ..../octave/scripts/miscellaneous/delete.m at line 51, column 1
error:   ..../octave/scripts/plot/closereq.m at line 37, column 7
error:   ..../octave/scripts/plot/close.m at line 63, column 5
error:   ..../octave/scripts/plot/close.m at line 77, column 1
error:   ..../octave/scripts/plot/close.m at line 46, column 7

Steps to reproduce:

hold on;
h1 = plot(2,3,'k*;data 1;');
h2 = plot(5,5,'ko;data 2;'); % optional
close all;

Torsten Lilge <ttl>
Project Member


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

Attach Files:

No files currently attached


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 ttl (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 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2012-10-30 rik5 StatusIn Progress => Fixed
        Open/ClosedOpen => Closed
    2012-10-30 rik5 StatusConfirmed => In Progress
    2012-10-30 rik5 Severity3 - Normal => 4 - Important
        Item GroupNone => Segfault, Bus Error, etc.
        StatusNone => Confirmed

    Back to the top

    Powered by Savane 3.5