Re: Patch for oafd_CORBA_Context_get_value
- From: Maciej Stachowiak <mjs eazel com>
- To: Bradford Hovinen <hovinen helixcode com>
- Cc: gnome-components-list gnome org
- Subject: Re: Patch for oafd_CORBA_Context_get_value
- Date: 06 Oct 2000 21:10:12 -0700
Bradford Hovinen <hovinen helixcode com> writes:
> Greetings,
>
> I was having some trouble with OAF -- it was setting the DISPLAY
> environment variable on launched components incorrectly. I tracked the
> problem down to a call to CORBA_Context_get_values. Rather than returning
> an array of just the DISPLAY environment variable as expected, it was
> returning an array of two values: the first was the username and the
> second was the display. oafd_CORBA_Context_get_value was naively returning
> just the first value in the array, and hence my display was getting set to
> "hovinen" rather than ":0".
That's an ORBit bug, try the latest on the stable branch and it will
work. (0.5.3 is not good enough).
> The patch I have attached fixes the problem by adding a loop that checks
> the name field of each returned array element against the propname
> parameter, returning only the correct value. It fixed the problem for me.
Feel free to apply the patch anyway though, best to be defensive.
> --
> -Bradford Hovinen
>
> "If the fool would persist in his folly he would become wise."
>
> - William Blake, "Proverbs of Hell," 1793
>
>
>
> Index: oafd/oafd-corba-extensions.c
> ===================================================================
> RCS file: /cvs/gnome/oaf/oafd/oafd-corba-extensions.c,v
> retrieving revision 1.3
> diff -u -r1.3 oafd-corba-extensions.c
> --- oafd/oafd-corba-extensions.c 2000/09/25 23:36:54 1.3
> +++ oafd/oafd-corba-extensions.c 2000/10/07 02:39:44
> @@ -51,10 +51,16 @@
> if (ev->_major == CORBA_NO_EXCEPTION) {
> if (nvout->list->len > 0) {
> CORBA_NamedValue *nv;
> + int i;
>
> - nv = &g_array_index (nvout->list, CORBA_NamedValue, 0);
> + for (i = 0; i < nvout->list->len; i++) {
> + nv = &g_array_index (nvout->list,
> + CORBA_NamedValue, i);
> + if (!strcmp (nv->name, propname)) break;
> + }
>
> - retval = g_strdup (*(char **) nv->argument._value);
> + if (i < nvout->list->len)
> + retval = g_strdup (*(char **) nv->argument._value);
> }
>
> CORBA_NVList_free (nvout, &local_ev);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]