hi, all:
I get the following idl file.
//interface.idl
interface InterfaceA {
void dummy();
};
interface InterfaceB {
readonly attribute InterfaceA a;
};
then i use orbit-idl to compile the idl file, it is fine.
but on my client progromm i use the following statement to get the object reference of InterfaceA(attribute a).
InterfaceB b;
InterfaceA ia;
...//do some init work, and get the object reference b
ia = InterfaceB__get_a(b, &env);
...//some other work
when i run the client programm, the server tell "segment fault" error.
i debug the progromm, both client and server.
i have see in the file interface-skels.c(generated by orbit-idl), the last statement of the following function:
void
_ORBIT_skel_InterfaceB__get_a(POA_Log *
_ORBIT_servant,
GIOPRecvBuffer *
_ORBIT_recv_buffer,
CORBA_Environment *
ev,
InterfaceA(*_impl__get_a)
(PortableServer_Servant
_servant,
CORBA_Environment * ev))
{
...
{
....
if (ev->_major ==
CORBA_NO_EXCEPTION)
CORBA_Object_release(_ORBIT_retval,
ev);
}
}
it is see when the function InterfaceB__get_a() invocated, we will free the object (InterfaceA a),
when next time to get involve into the function, there is no object (InterfaceA a), so error generated,
when i comment the two line, my programm work fine.
that is say:
the idl compiler has some bugs?
i think the following should be right:
if (ev->_major !=
CORBA_NO_EXCEPTION)
CORBA_Object_release(_ORBIT_retval,
ev);