octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #35857] Octave crashes when plotting with unit


From: Rik
Subject: [Octave-bug-tracker] [bug #35857] Octave crashes when plotting with units = normalized
Date: Fri, 03 Apr 2015 19:52:57 +0000
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:36.0) Gecko/20100101 Firefox/36.0

Follow-up Comment #8, bug #35857 (project octave):

I've single-stepped through a lot of code and figured a bit about what is
happening.

Using the original example:


set (0, "defaulttextunits", "normalized");
plot (0.05*[0 1])


The first call to set is fine.  The plot call invokes newplot() to prepare the
figure and axes.  At the end of newplot this involves calling


__go_axes_init__ (ca, "replace");
__request_drawnow__ ();


The backtrace of interest is


#0  text::properties::update_units (this=0x7fffd853c700) at
corefcn/graphics.cc:8150
#1  0x00007ffff7017036 in text::properties::set_units (this=0x7fffd853c700,
val=...)
    at corefcn/graphics.h:8215
#2  0x00007ffff6f5a238 in text::properties::set (this=0x7fffd853c700,
pname_arg=..., val=...)
    at corefcn/graphics-props.cc:3315
#3  0x00007ffff700404b in base_graphics_object::set (this=0x7fffd853c6f0,
pname=..., pval=...)
    at corefcn/graphics.h:2991
#4  0x00007ffff6ef8a10 in base_properties::set_from_list (this=0x7fffd853c700,
obj=..., defaults=...)
    at corefcn/graphics.cc:2885
#5  0x00007ffff7003fd1 in base_graphics_object::set_from_list
(this=0x7fffd853c6f0, plist=...)
    at corefcn/graphics.h:2983
#6  0x00007ffff7006447 in root_figure::override_defaults (this=0x655760,
obj=...)
    at corefcn/graphics.h:3792
#7  0x00007ffff7004ef2 in graphics_object::override_defaults
(this=0x7fffdc914040, obj=...)
    at corefcn/graphics.h:3262
#8  0x00007ffff6ef970c in base_properties::override_defaults
(this=0x7fffd84ad360, obj=...)
    at corefcn/graphics.cc:3069
#9  0x00007ffff7009cf9 in figure::override_defaults (this=0x7fffd84ad350,
obj=...)
    at corefcn/graphics.h:4916
#10 0x00007ffff7004ef2 in graphics_object::override_defaults
(this=0x7fffdc9140d0, obj=...)
    at corefcn/graphics.h:3262
#11 0x00007ffff6ef970c in base_properties::override_defaults
(this=0x7fffd84dc5d0, obj=...)
    at corefcn/graphics.cc:3069
#12 0x00007ffff7013735 in axes::override_defaults (this=0x7fffd84dc5c0,
obj=...)
    at corefcn/graphics.h:7186
#13 0x00007ffff7004ef2 in graphics_object::override_defaults
(this=0x7fffdc914160, obj=...)
    at corefcn/graphics.h:3262
#14 0x00007ffff6ef970c in base_properties::override_defaults
(this=0x7fffd853c700, obj=...)
    at corefcn/graphics.cc:3069
#15 0x00007ffff70181a4 in text::text (this=0x7fffd853c6f0, mh=..., p=...) at
corefcn/graphics.h:8463
#16 0x00007ffff6eebd00 in make_graphics_object_from_type (type=..., h=...,
p=...)
    at corefcn/graphics.cc:1019
#17 0x00007ffff6fece8d in gh_manager::do_make_graphics_handle (this=0x654d10,
go_name=..., p=..., 
    integer_figure_handle=false, do_createfcn=false, do_notify_toolkit=true)
at corefcn/graphics.cc:9096
#18 0x00007ffff7028eac in gh_manager::make_graphics_handle (go_name=...,
parent=..., 
    integer_figure_handle=false, do_createfcn=false, do_notify_toolkit=true)
at corefcn/graphics.h:13237
#19 0x00007ffff6fc9a8c in axes::properties::set_defaults (this=0x7fffd84dc5d0,
obj=..., mode=...)
    at corefcn/graphics.cc:5075
#20 0x00007ffff70138d7 in axes::set_defaults (this=0x7fffd84dc5c0, mode=...)
at corefcn/graphics.h:7209
#21 0x00007ffff7004f98 in graphics_object::set_defaults (this=0x7fffdc9156c0,
mode=...)
    at corefcn/graphics.h:3288
#22 0x00007ffff6ff459c in F__go_axes_init__ (args=...) at
corefcn/graphics.cc:10706



text::properties::update_units (void)
{
  if (! units_is ("data"))
    {
      set_xliminclude ("off");
      set_yliminclude ("off");
      set_zliminclude ("off");
    }

  Matrix pos = get_position ().matrix_value ();

  pos = convert_text_position (pos, *this, cached_units, get_units ());
  // FIXME: if the current axes view is 2D, then one should
  // probably drop the z-component of "pos" and leave "zliminclude"
  // to "off".
  set_position (pos);


The initial position returned in pos is (0,0,0).  The value of pos after
convert_text_position() is an empty matrix.  The subsequent call of
set_position (pos) then causes a chain of errors.

The top of the convert_text_position() function is shown below.


static Matrix
convert_text_position (const Matrix& pos, const text::properties& props,
                       const caseless_str& from_units,
                       const caseless_str& to_units)
{
  graphics_object go = gh_manager::get_object (props.get___myhandle__ ());
  graphics_object ax = go.get_ancestor ("axes");

  Matrix retval;

  if (ax.valid_object ())


What happens is that ax.valid_object () returns false, and so retval assumes
the default value of 2-D empty matrix.  Why is the axes not valid?  That is
the question.  I hacked a solution by using an else clause off the if
statement and returning the input pos if the axis is not valid.  This works
and stops the segfault, but doesn't put the labels in the correct location.

The chain starts in axes::properties::set_defaults in graphics.cc.  The first
thing the code does is delete all the axes children.  This succeeds.  It is
the first call to make_graphics_handle that fails.  Maybe the problem is that
somehow the adoption needs to take place first in order for get_ancestor
("axes") to return a valid object.


delete_children (true);

xlabel = gh_manager::make_graphics_handle ("text", __myhandle__,
                                           false, false);
ylabel = gh_manager::make_graphics_handle ("text", __myhandle__,
                                           false, false);
zlabel = gh_manager::make_graphics_handle ("text", __myhandle__,
                                           false, false);
title = gh_manager::make_graphics_handle ("text", __myhandle__,
                                          false, false);
adopt (xlabel.handle_value ());
adopt (ylabel.handle_value ());
adopt (zlabel.handle_value ());
adopt (title.handle_value ());





    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?35857>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]