[Expat-discuss] How the attributes of "userdata" are altered withevery handler function call?

Reid Spencer reid at x10sys.com
Thu Jul 7 19:16:23 CEST 2005


I've been helping Rodrigo with this off-list. He shared some code with
me and it looks like he was holding on to some pointers provided to the
callback functions rather than copying the strings they pointed to. I
made some suggestions on how he could improve his code. Hopefully that
will solve his issue. I don't think his situation has any pertinence to
expat itself; its mostly a usage issue.

Reid.

On Thu, 2005-07-07 at 08:31 -0700, Greg Martin wrote:
> Without seeing your code I'd suggest you have a wild pointer somewhere in your program - you are writing to memory you don't own and causing undefined behaviour.
> 
> > -----Original Message-----
> > From: expat-discuss-bounces at libexpat.org 
> > [mailto:expat-discuss-bounces at libexpat.org] On Behalf Of 
> > rodrigo_mora at sympatico.ca
> > Sent: Wednesday, July 06, 2005 2:32 PM
> > To: expat-discuss at libexpat.org
> > Subject: [Expat-discuss] How the attributes of "userdata" are 
> > altered withevery handler function call?
> > 
> > Hello,
> > 
> > I have built a C Struc to keep track of the elements and 
> > attributes that the handler functions read. I make the 
> > explicit cast from "void* data* to my C Struc. In the first 
> > pass, the attributes are stored correctly in the C Struct. 
> > However, every time the handlers are called, the C Struct 
> > attributes (that were initially stored correctly) change. 
> > 
> > In other words, every time the handlers are called they 
> > override part of the information that has been stored (but 
> > not through the program logic). Is like the "void* user data" 
> > argument is corrupted with each handler function call.
> > 
> > I have been trapped with this problem for a week. Does 
> > anybody have an idea of why this is happening?
> > 
> > Thank you in advance for your help!
> > -Rodrigo
> > 
> > 
> > _______________________________________________
> > Expat-discuss mailing list
> > Expat-discuss at libexpat.org
> > http://mail.libexpat.org/mailman/listinfo/expat-discuss
> > 
> _______________________________________________
> Expat-discuss mailing list
> Expat-discuss at libexpat.org
> http://mail.libexpat.org/mailman/listinfo/expat-discuss
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://mail.libexpat.org/pipermail/expat-discuss/attachments/20050707/87e0d196/attachment.pgp


More information about the Expat-discuss mailing list