Re: CORBA_any's
- From: Michael Meeks <michael ximian com>
- To: Rodrigo Moya <rodrigo ulises openresources com>
- Cc: <gnome-components-list gnome org>
- Subject: Re: CORBA_any's
- Date: Sun, 4 Nov 2001 17:18:20 -0500 (EST)
Hi Rodrigo,
On 3 Nov 2001, Rodrigo Moya wrote:
> typedef CORBA_any GdaValue;
>
> GdaValue *gda_value_new (void);
> gchar *gda_value_get_string (GdaValue *value);
> void gda_value_set_string (GdaValue *value, const gchar *str);
> void gda_value_set_integer (GdaValue *value, gint i);
> ...
>
> What I'm trying to do is to have a CORBA_any whose CORBA_TypeCode and
> value can be changed on the fly. So, in gda_value_set_string I do:
>
> CORBA_Object_release ((CORBA_Object) value->_type, NULL);
>
> value->_type = (CORBA_TypeCode) CORBA_Object_duplicate (
> (CORBA_Object) TC_CORBA_string, NULL);
> BONOBO_ARG_SET_STRING (value, val);
Um ! ? how do you create the Any ? bonobo_arg_new ? I would use:
char *foo = "My String";
bonobo_arg_new_from (TC_CORBA_string, &foo);
> I do this because I've seen, in bonobo-arg.c (bonobo_arg_new_from),
> that the _type member is CORBA_Object_duplicate'd.
The code looks fine; you need to release the type before setting
it to anything else; quite right.
> But, it seems it's not the correct way, since in another function
> (after having called gda_value_set_string), the _type member is just
> full of garbage.
This sounds like memory corruption / bad handling of something.
Perhaps you freed the any too soon and are looking at released memory (
try electric fence ). Either way, prolly not a bonobo problem since
the contents of memory should stay set to what you set it to :-)
Regards,
Michael.
--
mmeeks gnu org <><, Pseudo Engineer, itinerant idiot
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]