bugGNU Octave - Bugs: bug #58998, Probably mistake in a...

 
 

bug #58998: Probably mistake in a "print.m"

Submitter:  Valdas <zmogas>
Submitted:  Sun 23 Aug 2020 02:44:52 PM UTC
   
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Unexpected Error or Warning
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * 6.0.90 Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Wed 26 Aug 2020 03:15:46 PM UTC, comment #6: 

Thanks for the feedback.

Closing report as fixed.

Markus Mützel <mmuetzel>
Group administrator
Wed 26 Aug 2020 02:41:08 PM UTC, comment #5: 

 Aha, "text" triggers that error.
 I tried your example (mine example was written in wrong direction), it produces error. After patch is applied example executes without error.
 Thanks!

Valdas <zmogas>
Wed 26 Aug 2020 01:43:21 PM UTC, comment #4: 

An example to reproduce this bug is:

hf = clf (figure (1));
hax = axes (hf);
hl = plot (hax, [0 1]);
ht = text (1.5, 0.5, "test");
set (ht, "Units", "pixels");

print (hf, "test_idx_error.png");


Your proposed change looks good to me. I pushed it to stable here:
https://hg.savannah.gnu.org/hgweb/octave/rev/60d2b3d903d4

Marking as ready for test.

Markus Mützel <mmuetzel>
Group administrator
Mon 24 Aug 2020 12:35:07 PM UTC, comment #3: 


> Would it be ok for you if I push that change with you as the author?


 No problem.
 I tried to study "print.m" but I can't fully understand it, so I don't know if that small change is enough. It simple mistake or there is deeper meaning in that whole code...

> Could you post a small example of calling print that causes this error please?


 I reverted my changes in "print.m" and I tried write small test project, but with no success: I cant get that error. I cant post my project (it is enormous :)
 That error is not very stable: I have 10 plots and I called "print" for them all in a row, error occurs one time for 2-th figure, another time for 3-th figure, today that produces no error. In my project several properties are added in to legend, and I remember that if I comment that code then error is gone, but if uncomment then error is back. A memory leak?

Valdas <zmogas>
Mon 24 Aug 2020 09:04:32 AM UTC, comment #2: 

Thanks for your bug report. That error is also present in the current stable branch.
Would it be ok for you if I push that change with you as the author?

Markus Mützel <mmuetzel>
Group administrator
Sun 23 Aug 2020 09:20:28 PM UTC, comment #1: 

Could you post a small example of calling print that causes this error please?

Anonymous
Sun 23 Aug 2020 02:44:52 PM UTC, original submission:  

 I searching what causes this strange error in my code when I execute "print":

error: props(8): out of bound 7
error: called from
    print at line 758 column 9

 In a file "print.m" I found possible cause:
  - starting from line #460 there is a block of code:

    ## Set the __printing__ property first
    props(1).h = opts.figure;
    props(1).name = "__printing__";
    props(1).value = {"off"};
    set (opts.figure, "__printing__", "on");
    nfig += 1;

  - after that block follows a second block of code:

    ## print() requires children of axes to have units = "normalized", or "data"
    hobj = findall (opts.figure, "-not", "type", "figure", ...
                    "-not", "type", "axes", "-property", "units", ...
                    "-not", "units", "normalized", "-not", "units", "data");
    hobj(strncmp (get (hobj, "type"), "ui", 2)) = [];
    for n = 1:numel(hobj)
      props(n).h = hobj(n);
      props(n).name = "units";
      props(n).value = {get(hobj(n), "units")};
      set (hobj(n), "units", "data");
      nfig += 1;
    endfor

 I think that a second block of code contains mistake because after that code:
  - changes made by first block of code is lost,
  - "nfig" is greater than element count in "props".
 If I modify the code in a second block, then my code runs without error:

. . .
      props(end+1).h = hobj(n);
      props(end).name = "units";
      props(end).value = {get(hobj(n), "units")};
. . .


Valdas <zmogas>

 

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

Attach Files:
   
   
Comment:
   

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 mmuetzel (Posted a comment)
  • -email is unavailable- added by zmogas (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 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2020-08-26 mmuetzel StatusReady For Test Fixed
        Open/ClosedOpen Closed
    2020-08-26 mmuetzel StatusConfirmed Ready For Test
    2020-08-24 mmuetzel StatusNone Confirmed
        Releasedev 6.0.90
        Operating SystemGNU/Linux Any

    Back to the top

    Powered by Savane 3.13-4b48.
    Corresponding source code