Problem marshaling CORBA Anys into skels.




    I'm encountering disconcerting problem when calling the set_value
method of the Bonobo Property interface.  The method looks like this:

	void set_value (in any value) raises (InvalidValue, ReadOnlyProperty);

And the problem looks like this:

(gdb) bt 2
#0  _ORBIT_skel_GNOME_Property_set_value (_ORBIT_servant=0x80a3c40, _ORBIT_recv_buffer=0x8090e28, ev=0xbffff700, _impl_set_value=0x4006d608 <impl_GNOME_Property_set_value>) at bonobo-skels.c:2107
#1  0x4030cd4f in ORBit_POA_handle_request (recv_buffer=0x8090e28, poa=0x8098700) at orbit_poa.c:500
(More stack frames follow...)
(gdb) list
2102				     (((ORBit_ObjectKey *) _ORBIT_servant->_private)->
2103				      object->orb));
2104		 _ORBIT_curptr = GIOP_RECV_BUFFER(_ORBIT_recv_buffer)->cur;
2105	      } else {
2106		 GIOP_RECV_BUFFER(_ORBIT_recv_buffer)->cur = _ORBIT_curptr;
2107		 ORBit_demarshal_any(_ORBIT_recv_buffer, &(value), CORBA_TRUE,
2108				     (((ORBit_ObjectKey *) _ORBIT_servant->_private)->
2109				      object->orb));
2110		 _ORBIT_curptr = GIOP_RECV_BUFFER(_ORBIT_recv_buffer)->cur;
2111	      }
(gdb) p *(ORBit_ObjectKey *) _ORBIT_servant->_private
$3 = {
  class_info = 0x4007d3a0, 
  object = 0x0
}

So, naturally, when line 2107 is executed, the thing seg faults
because it tries to access object->orb, and object is NULL.  Now, I
don't know if this is an ORBit problem or if I'm not using the
ServantLocator properly.  Here's how I create the servant:

PortableServer_Servant
gnome_property_servant_new (PortableServer_POA adapter, GnomePropertyBag *pb,
			    char *property_name)
{
	GnomePropertyServant	*servant;
	CORBA_Environment        ev;

	g_return_val_if_fail (pb != NULL, NULL);
	g_return_val_if_fail (GNOME_IS_PROPERTY_BAG (pb), NULL);
	g_return_val_if_fail (property_name != NULL, NULL);

	/*
	 * Verify that the specified property exists.
	 */
	if (! gnome_property_bag_has_property (pb, property_name))
		return NULL;

	CORBA_exception_init (&ev);

	/*
	 * Create a transient servant for the property.
	 */
	servant = g_new0 (GnomePropertyServant, 1);

	servant->property_name = g_strdup (property_name);
	servant->pb = pb;

	((POA_GNOME_Property *) servant)->vepv = gnome_property_get_vepv ();
	
	POA_GNOME_Property__init ((PortableServer_Servant) servant, &ev);
	if (ev._major != CORBA_NO_EXCEPTION) {
		g_warning ("GnomeProperty: Could not initialize Property servant");
		g_free (servant->property_name);
		g_free (servant);
		CORBA_exception_free (&ev);
		return NULL;
	}

	CORBA_exception_free (&ev);

	return servant;
}

As I understand it, with the ServantLocator, that's all I have to do
to create a usable servant.  Am I missing something or is ORBit?

Nat



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]