On Wednesday 03 November 2010 21:05:41 you wrote: > On Wed, 2010-11-03 at 18:43 +0100, Alessandro Pignotti wrote: > > I've a proposal, the code could be modified to call > > xmlRegisterNodeDefault before any xmlNew* call and to reset the handler > > to the default one after that. > > This approach would preserve the current interface while making libxml++ > > less intrusive. I'm working on a patch to implement this solution, any > > comment? > > I'd like to preserve any existing state, and a patch for that would be > welcome. > > However, doing that only at first use is a) harder to get right always > and b) might cause a slow down later rather than sooner, just at the > point where it's most annoying. So I'd like to consider that separately. > It's not enough to do the RegisterNode and DeregisterNode handlers setup at first use. They must be set up and reset each time a libxml2 call (that could create a new node) is used. IMHO is not correct to override the handlers for the whole calling thread (where normal libxml2 might be in use), and even less overriding them for newly created threads. The approach I'm proposing involves setting and resetting the handlers each time as needed guaranteeing that, when leaving libxml++ code the state is the one as expected by the environment. I think the handlers are (or are accessed through) thread local variables so setting them is relatively fast. Anyway I really feel the current implementation is broken and not correctly encapsulated from the environment. Best regards, Alessandro Pignotti
Attachment:
signature.asc
Description: This is a digitally signed message part.