[omniORB] What's wrong with my code?

Ilinykh, Andre AIlinykh@SECTORBASE.COM
Tue, 20 Feb 2001 18:28:56 -0800


Hi!
I'm trying to do simle thing- to put my structure into Any and then extract
it. My structure data is 
struct bidask {
	string symbol;
	// other fields (int, float ...)
}
Code looks like
{
	CORBA::Any any;
	bidask ba;
	ba.symbol=(const char*)"XYZ";
			
	any<<=(const bidask)ba;
	const bidask*  pBA;
	any>>=pBA;
}

When I leave this block I get a problem. Call stack is:

NTDLL! 77f9f9df()
NTDLL! 77fb4966()
NTDLL! 77f8b3d2()
KERNEL32! 77e944cd()
_CrtIsValidHeapPointer(const void * 0x00465bf8) line 1606
_free_dbg(void * 0x00465bf8, int 1) line 1011 + 9 bytes
operator delete(void * 0x00465bf8) line 49 + 16 bytes
omni::freeString(char * 0x00465bf8) line 240 + 33 bytes
_CORBA_String_member::~_CORBA_String_member() line 199 + 11 bytes
bidask::~bidask() + 37 bytes
bidask::`scalar deleting destructor'(unsigned int 1) + 37 bytes
_0RL_delete_bidask(void * 0x005617e0) line 30 + 28 bytes
AnyP::~AnyP() line 81 + 13 bytes
AnyP::`scalar deleting destructor'(unsigned int 1) + 15 bytes
CORBA::Any::~Any() line 174 + 33 bytes
main(int 3, char * * 0x00560e80) line 115 + 30 bytes
mainCRTStartup() line 206 + 25 bytes
KERNEL32! 77e87903()

It looks like both 'any' and 'ba' try to deallocate the same memory. But
"any<<=ba" has to make deep copy! What's wrong? 
One more interesting thing. When I remove last two lines:

{
	CORBA::Any any;
	bidask ba;
	ba.symbol=(const char*)"XYZ";
			
	any<<=(const bidask)ba;
}

Everything is Ok. What's going on? Who can me explain?
Thank you,
  Andrey