ZeroC

Archived

This forum has been archived. Please start a new discussion on GitHub.

Object* add(Object servant, Identity id),can the servant be static object?

russule
russule
Hi,
I did a test, wrote a server with Ice.3.2.0 in windows xp.
static confI* Inst()
	{
		static confI cb;
		return &cb;
	};	
adapter->add([B]confI::Inst(), [/B]communicator()->stringToIdentity("conf"));

The server runs well, but when i closed it,it occurs excetion.

Debug Assertion Failed!
File:dbgheap.c
Line:1044
Expression:_CrtIsValidHeapPointer(pUserData)


When I didn't use the static object,
adapter->add(new [B]confI,[/B]communicator()->stringToIdentity("conf"));
there was no exception occured.

the Object* add(Object servant, Identity id) function.
can the servant be the static object?
Thanks!

Comments

  • dwayne
    dwayne St. John's, Newfoundland
    Ice servants must be allocated on the heap. Please see this FAQ for a complete explanation.
  • marc
    marc Florida
    Also, can you please check your private messages and get back to us?