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 David Chinn <Da...@Ingeniux.com> on 2000/10/27 21:29:46 UTC

deleting a transcode return results in assertion on windows

I apologize in advance if this has been reported previously; I couldn't
find the link to the buglist.

The following code asserts when deleting p:

int main(int argC, char* argV[])
{
	XMLPlatformUtils::Initialize();

	DOMString s ("The Rain in Spain");

	char *p = s.transcode();
	delete p;
}

OS: windows NT/SP6
Compiler: Visual C++ v 6.0
Xerces: 1.3.0
lib: xerces-c_1.lib

It seems to fail when trying to determine the validity of the pointer being
deleted.  A comment
in the debug version of the CRT (c run time) indicates the following.

	" Pointers from non-local heaps cannot be handled. For example, a
	  non-local pointer may come from a DLL that has the CRT linked-in."

In the visual c++ IDE, under C++ tab of Project/Settings, the code
generation section gives
a number of versions of the CRT to link with.

The interesting thing is this does not fail when linking with
xerces-c_1D.lib.



Re: deleting a transcode return results in assertion on windows

Posted by Reyes Ponce <Re...@naxs.com>.
I seem to recall several people reporting problems like this in the past on
this list and the answer always seems to be that you need to make sure you
are using the same CRT version that Xerces uses (ie. your code should be
using the multithreaded DLL CRT for a release build and debug multithreaded
DLL CRT for a debug build).

Is that the CRT you are linking with?

----- Original Message -----
From: "David Chinn" <Da...@Ingeniux.com>
To: <xe...@xml.apache.org>
Sent: Friday, October 27, 2000 3:29 PM
Subject: deleting a transcode return results in assertion on windows


> I apologize in advance if this has been reported previously; I couldn't
> find the link to the buglist.
>
> The following code asserts when deleting p:
>
> int main(int argC, char* argV[])
> {
> XMLPlatformUtils::Initialize();
>
> DOMString s ("The Rain in Spain");
>
> char *p = s.transcode();
> delete p;
> }
>
> OS: windows NT/SP6
> Compiler: Visual C++ v 6.0
> Xerces: 1.3.0
> lib: xerces-c_1.lib
>
> It seems to fail when trying to determine the validity of the pointer
being
> deleted.  A comment
> in the debug version of the CRT (c run time) indicates the following.
>
> " Pointers from non-local heaps cannot be handled. For example, a
>   non-local pointer may come from a DLL that has the CRT linked-in."
>
> In the visual c++ IDE, under C++ tab of Project/Settings, the code
> generation section gives
> a number of versions of the CRT to link with.
>
> The interesting thing is this does not fail when linking with
> xerces-c_1D.lib.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
>
>


Re: deleting a transcode return results in assertion on windows

Posted by Lawrence You <yo...@pixo.com>.
>	char *p = s.transcode();
>	delete p;

How about using delete[] instead of delete? For example:

delete[] p;

-Lawrence