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: John W. Eaton
Subject: [Octave-bug-tracker] [bug #35857] Octave crashes when plotting with units = normalized
Date: Fri, 03 Apr 2015 23:31:18 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Firefox/31.0 Iceweasel/31.2.0

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

Rik, thanks for all that info.  I was headed in that direction, but I think
you definitely saved me some time.

I'm attaching a patch and hoping that the following explains it at least a
little.

OK, so there are a couple of things happening here.

One is that we call


  xproperties.override_defaults (*this);


from inside constructors and then expect to be able to get the actual type of
"this", but since "this" is being used before it is fully constructed, it is
just a pointer to the base type.  I guess C++ wizards would know that you
can't dispatch to virtual functions from inside a constructor?

So that makes the call to valid_object in override_defaults return false
because it is always the function from the base class.  Oops.  My patch avoids
this problem by moving the call to override_defaults outside of the
constructor.  But I think a better solution would be a way to apply defaults
from the parent objects from inside the constructor.

The second issue was that we were doing something like this:


  delete_children (true);

  xlabel = gh_manager::make_graphics_handle ("text", ...);


but while constructing the new text object, we tried to update positions of
xlabel, ylabel, etc.  That failed because we were accessing the xlabel object
that was no longer valid, but apparently the handle was still accessible
somehow.  In any case, I worked around this problem by first invalidating the
handles, then constructing them.  At the point inside the construction of
these objects where the position is updated, I just skip that if the handles
are not valid.  Then I call the update functions in the
axes::properties::set_defaults function after xlabel, ylabel, etc. are
otherwise fully initialized.

Please take a look at the patch.  I'm sure it could be improved, but it seems
to avoid the crash for me.

(file #33523)
    _______________________________________________________

Additional Item Attachment:

File name: diffs.txt                      Size:8 KB


    _______________________________________________________

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]