[omniORB] activate_object

yashik@veon.com yashik@veon.com
Wed, 8 May 2002 18:43:19 +0200


You're absolutely right, that is exactly what happens. Although, in release
version on Win2000 and on solaris works fine I get a crash in debug version
on Win2000.
The strange thing is that I'm not mixing debug&release versions of the
libraries.
I'm using debug libraries of omniORB (omniORB304_rtD.lib
omnithread2_rtD.lib msvcstubD.lib) in my debug version.
Win2000, MSVC 6,
Debug Multithreaded settings. Defines:   _DEBUG,WIN32,_CONSOLE,_MBCS,
__x86__,__NT__,__OSVERSION__=4,__WIN32__
What I'm doing wrong?

Also, if returned value of activate_object should be put in _var variable,
does it mean that in order to avoid memory leaks one always should receive
it? Although I'm a newbie, I've seen not once lines like
  poa->activate_object(some_servant);
Is it a leak?

Thank you,
Yakov.


> PortableServer::ObjectId_var oid = m_POA->activate_object(my_servant);
> CORBA::Object_var obj = m_POA->id_to_reference(oid.in());
>
> Unfortunately, I get a crash as soon as 'oid' variable gets out of scope.
> Adding
>      oid._retn();
> after id_to_reference call corrects the problem, but this looks like a
> potential problem: if the exception is thrown before the oid._retn()
call,
> the variable will be released, causing the crash.

Almost certainly, you are using Windows, and the crash is something
about crtIsValidHeapPointer. If so, the problem is that you are mixing
debug application code with non-debug versions of the omniORB
libraries. Windows doesn't like that. Make sure you always match
debugging options.

If that isn't the problem, what platform are you using, and what
exactly happens in the crash?

Cheers,

Duncan.