Re: [Libxmlplusplus-general] parametrizing libxml++ for the character /string type



On Wed, 2003-01-29 at 15:11, Stefan Seefeld wrote:
> > So, we create new xmlpp::Nodes to wrap each xmlNode, but when do those
> > xmlpp::Nodes get deleted?
> 
> That's indeed one of those questions that are still a bit unclear. I see
> two possibilities:
> 
> * parent xmlpp::Node objects explicitely destroy their child objects
> 
> or
> 
> * xmlpp::Node objects are owned by their libxml2 counterparts. This can
>    work thanks to a recent addition from Daniel: since libxml2 2.5.1 you
>    can install callbacks that are called on libxml2 object
>    creation/deletion, so we can manage the _private members there

This is by far the best solution. It sounds like what we do in gtkmm,
which works.

We must fix these memory leaks before we can think of applying the
patch.

> I tend to think the second is much more clean and consistent with the
> rest of the proposed change. However, Daniel seemed not 100 % confident
> that this works in all cases. Possibly because we'd be the first to use
> (and stress-test) that feature. We'll have to try it out, I guess.

Sure. We can do that.

> >>The tricky point is, as said earlier, ownership management. libxml2's nodes
> >>are owned by their parent nodes (and ultimately by the enclosing document),
> >>not by the libxml++ wrapper object. We need to work out how transfer of ownership
> >>should happen when a node is unlinked from its document / parent node.
> > 
> > 
> > Is there any way to get notification of this?
> 
> yes, see above.
> 
> Regards,
> 		Stefan
> 
> PS: the patch I sent in yesterday doesn't cover all objects. After 
> having sent in the patch I continued with more objects, notably adding
> a 'Document' type.

Please keep changes in separate patches. I don't see how the addition of
a Document type has anything to do with the other changes.

>  I'll wait with these patches as that'll involve some
> more changes, possibly also on the API level.

-- 
Murray Cumming
murray usa net
www.murrayc.com





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