Hi Björn,
Hello,
in my application I'm using generic field access
methods in a similar fashion as in OSG::deepClone
(OSGNode.cpp), i.e. for any kind of FieldContainer
field I'm accessing it through S- and
MFFieldContainerPtr.
Now I noticed that the generic access does not work
correctly with FCs where the set-method of a certain
field has side-effects.
Take Node and its core field as an example:
Node::setCore() performs an addRefCP() on the new
core, a subRefCP on the old core and adjusts their
parents list accordingly.
Generic access: Node is an FC and its "Core" field is
derived from SFFieldContainerPtr.
sfield.setValue(newCorePtr) then sets the new core of
that field, but it does not handle ref counting or the
parents lists. :-(
Yes that's kind of buggy in the moment.
I suppose deepClone does a similar mistake, only that
it performs an addRefCP EVERY TIME (line 788).
That seems to be wrong to me too. Again, take Node and
its core as an example: Node should perform an
addRefCP on its core, but the core should not addRefCP
each of its parents.
(I admit that I haven't checked deepClone well enough,
so sorry if the claim in this paragraph is wrong.)
Interesting point but if I'm not wrong I think it is correct to
increment the reference counter for the parent nodes. The new deep
cloned core references the new deep cloned node.
One solution that comes to mind is moving all side
effects into the changed-method of each
FieldContainer, since that is called after each
endEditCP. That solution has two weaknesses:
1) In the Node-core-example, the new core could be
addRefCP'd and its parent list updated in changed.
However, the Ptr of the old core is not known anymore,
so it can't be updated.
2) What if endEditCP is not called? I'm not calling
endEditCP when I'm changing internal (i.e.
thread-local or cluster-local) fields of an FC (is
that wrong?).
I hope this problem can be solved, otherwise an
important part of my application code can be moved to
Ablage P.
This problem is already fixed in the upcoming OpenSG 2.0 release :-) We
will realease quite soon OpenSG 1.6 with new features and bugfixes.
First 2.0 betas are expected to Siggraph in August.
Andreas
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users