Re: [g-a-devel]GNOME Speech Weirdness - solution(s)



Hi Marc,

	A long mail - just to say to start with, that things are getting a lot
nicer in gnome-speech, which is excellent;

On Fri, 2002-09-13 at 02:08, Marc Mulcahy wrote:
> Blam!

	:-)

> It looks to me as though something has caused the stack to blow up (entry 
> to g_malloc shows n_bytes to be corrupted)a but the value passed to 
> g_malloc from CORBA_string_alloc looks OK.

	I'd guess instead that the g_malloc trace is bogus - and that we're
just getting standard heap corruption.

>  It appears to be attempting to 
> throw a "COM failure" exception, but this is the same behavior I was seeing 
> with the Viavoice driver when it was simply trying to demarshal a string 
> within a sequence of structs.

	Interesting; I'll have a poke.

> I have a bad feeling that this is something dumb I'm doing and not 
> seeing...  Flames welcome <sigh> :)

	:-)

	reading test-speech.c again I see:

static CORBA_Object
select_server ()

	You know how many arguments select_server takes: none, so I suggest
using 'select_server (void)' for good style.

	Looking at the prevalance of:

  text = g_strdup_printf ("%d parameters supported.\n", list->_length);
  printf (text);
  GNOME_Speech_SynthesisDriver_say (driver, text, &ev);
  g_free (text);

	I would write a 'speech_driver_say (driver *, char *, ...); simply for
good style,

  if (driver_name)
    {
      printf ("Driver naem: %s\n", driver_name);
      CORBA_free (driver_name);
    }

	Of course, as I say, CORBA strings can never be NULL, so the branches
here are unnecessary, but of course you do need a branch:

  if (!BONOBO_EX (&ev)) {
  }

	Since a method will return an un-initialized value on failure; ie. if
you do CORBA_free (Foo_getString (obj, &ev)); you just wrote a bug,
since it might be uninitialized [ as per. the spec. ].

	I think it's prolly worth diluting this, and giving harder garentees
for the next rev. of ORBit2 - but until then you have to check for
exceptions before using (especially freeing) the result of a method:

	Oh; looking at the warnings again:
synthesisdriver.c: In function `impl_getParameterValueDescription':
synthesisdriver.c:160: warning: `d' might be used uninitialized in this
function

	It looks like we need a d=NULL, in case tmp == NULL at entry; and of
course a (d && d->desc ? d->desc : "") in the dup.

	Doing a make install after a clean configure I got:

Making install in java
make[1]: Entering directory `/opt/ngnome2/src/gnome-speech/java'
no \
-emitAll -i /usr/share/idl/bonobo-activation-2.0 \
-pkgPrefix GNOME org \
-pkgPrefix Bonobo org.GNOME \
-fallTie ../idl/*.idl 
/bin/sh: no: command not found
make[1]: *** [org/GNOME/Speech/*.java] Error 127
make[1]: Leaving directory `/opt/ngnome2/src/gnome-speech/java'
make: *** [install-recursive] Error 1

	Bingo - found the problem:

(gdb) 
#9  0x08049259 in do_test (driver=0x80568f8) at test-speech.c:172
172           CORBA_free (synth_name);
(gdb) l
167         }
168       synth_version =
GNOME_Speech_SynthesisDriver__get_synthesizerVersion (driver, &ev);
169       if (synth_version)
170         {
171           printf ("Synthesizer Version: %s\n", synth_version);
172           CORBA_free (synth_name);
173         }
174
175       printf ("\nPlease select a test.\n\n");
176       GNOME_Speech_SynthesisDriver_say (driver, "Please select a
test.", &ev);

	cf. line 172 for the obvious mistake.

	How I found this so fast, is because in my default (Linux/glibc)
environment I always do export MALLOC_CHECK_=2, which increases the cost
of memory allocation, but will (often) tell you when you double free /
free in error. Well worth exporting for most hackers.

	HTH, I'm sure it's the fix.

	Regards,

		Michael.

-- 
 mmeeks gnu org  <><, Pseudo Engineer, itinerant idiot




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