AW: Re: [omniORB] Debug Assertion Failed although compiled with *.rtd.lib and run the Debug.exe?

Uli Syber uli.syber@schraml.de
Thu Dec 12 13:08:01 2002


Hi Duncan,

thanks a lot for your help. When I try to fill the wstring sequence with a wstring from an array and send it, the Assertion appears again.

void Echo_i::echoString(Example::StringList_out idList,CORBA::Long& length)
{
	wchar_t** list;
	list=getIDList(&len);	//return((wchar_t**)idList);
	
	idList = new Example::StringList(len);
    	idList->length(len);	
	length=len;

 	for(i=0;i<len;i++)
 	{ 		

        		(*idList)[i] =(const CORBA::WChar*)list[i];		
		CoTaskMemFree(list[i]);
 		//wprintf(L"myList: %s\n",*(List+i));
 	}
}				
 

with greetings,
Uli
 

> -----Ursprüngliche Nachricht-----
> Von: Duncan Grisby[mailto:duncan@grisby.org]
> Gesendet: Donnerstag, 12. Dezember 2002 12:13
> Betreff: Re: [omniORB] Debug Assertion Failed although compiled with *.rtd.lib and run the Debug.exe?
> 
> On Monday 9 December, "Uli Syber" wrote:
> 
> > 	idList= new Example::StringList(len);
> > 	idList->length(len);	
> > 	(*idList)[0]=(L"Hello world");
> 
> > The message in the wstring array is correctly send form the server
> > to the client but after that the omniORB server stops with the
> > Assertion message.
> 
> What is the message?
> 
> Try changing the last line of code I've quoted to be
> 
>   (*idList)[0]=(const CORBA::WChar*)(L"Hello world");
> 
> String and wstring literals are meant to be const in standard C++, but
> VC++ might get it wrong, meaning the sequence tries to free the string
> literal when it is deleted.
> 
> Cheers,
> 
> Duncan.
> 
> -- 
>  -- Duncan Grisby         --
>   -- duncan@grisby.org     --
>    -- http://www.grisby.org --
> _______________________________________________
> omniORB-list mailing list
> omniORB-list@omniorb-support.com
> http://www.omniorb-support.com/mailman/listinfo/omniorb-list