[Changeset]: Re: cla() ?
Ben Abbott
bpabbott at mac.com
Fri Oct 10 06:40:42 CDT 2008
On Oct 10, 2008, at 4:35 AM, Michael Goffioul wrote:
> On Wed, Oct 8, 2008 at 8:26 PM, John W. Eaton
> <jwe at bevo.che.wisc.edu> wrote:
>> On 7-Oct-2008, Michael Goffioul wrote:
>>
>> | While we're talking about __go_delete__, does anybody
>> | remember what was the idea behind removing an object
>> | from its parent's children in __go_delete__, instead of
>> | gh_manager::free? This makes life slighlty more complex
>> | if you want to delete an object from C++, where you would
>> | typically use gh_manager::free, but you then have to remove
>> | the child manually from its parent's children.
>> |
>> | I don't think I wrote that part of the code, and I can't figure
>> | out why it is written that way.
>>
>> It's likely that I wrote it, and I assumed that a call to the delete
>> function should remove the handle from its parent's list of children.
>> Is that not what should happen? If not, then what should happen?
>> For
>> example, what does Matlab do for
>>
>> h = line (); get (gca (), 'children'), delete (h); get (gca (),
>> 'children')
>>
>> ? Shouldn't the children of the current axes be empty after H is
>> deleted? If that doesn't happen automatically in the delete
>> function,
>> then how does it happen?
>
> It should definitely be removed from the children list, that's not the
> problem here. My question is why is that operation (== removing
> the handle from its parent's children) in __go_delete__ and not in
> gh_manager::free.
>
> I'm asking, because when you want to delete an object from C++
> world, you typically call gh_manager:free. But this does not take
> care of updating the parent's children and you might easily forget
> about it.
>
> Michael.
It does not appear that __go_delete__ does the job properly either.
octave-3.1.51+:1> figure(1)
octave-3.1.51+:2> axis
ans =
0 1 0 1 0 1
octave-3.1.51+:3> gca
ans = -1.3284
octave-3.1.51+:4> delete(gca)
octave-3.1.51+:5> get(gcf,'currentaxes')
ans = -1.3284
Ben
More information about the Octave-maintainers
mailing list