You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by Gary Marsh <gm...@goship.com> on 2001/04/19 20:16:46 UTC
Deleting char* returned from DOMString.transcode() in VC++ 6.0
Hi,
I am experiencing a problem deleting character pointers
that
are returned from the xerces library class DOMString via
the
transcode() function. The exact error message from the
debugger
is a little bit convoluted due to the fact that I also
have the NuMega's
DevPartner debug program running in conjunction with
VC++. Basically
though they throw an error claiming that I am trying to
delete something
that was allocated on the heap in another, for lack of a
better definition, "Name Space",
i.e. your library.
I got around the problem by adding a function in the
DOMString class
that deletes a character pointer passed in the parameter
list. I don't know if this is
just a quark of Microsoft's compiler or the Windows 2000
operating system or the
combination of VC++ and NuMega debugging tools but this
seems to have solved
the problem.
My code snippet looks something like this:
==============================
DOM_Node item;
string nodeName;
.....(assign the item valid information here)
.
.
char* name = item.getNodeName().transcode();
nodeName.assign( name);
DOMString::transcodeDelete( name );
==============================
I declared the function
DOMString::transcodeDelete(char*) is a static public function.
I used the source from your build on 4-10-2001.
I don't know if this is the appropriate fix but it seems
to work and I was able to reduce
my memory loses without the debugger throwing flags.
Gary Marsh
Senior Systems Developer
GoShip
27721 La Paz Rd. Unit B
Laguna Niguel, CA 92677
gmarsh@GoShip.com
Tel: 949-268-1094
Fax: 949-268-1001
www.goship.com
"GoShip...E-commerce solutions that deliver"