On Sat, Dec 10, 2011 at 03:23:10AM +0100, David Ne??as wrote:
> Date: Sat, 10 Dec 2011 03:23:10 +0100
> From: David Ne??as
> Subject: Re: Why cani i initialize "prefix" with a default string?
> To: Gary Kline
> Cc: GTK Devel List
>
> On Fri, Dec 09, 2011 at 05:40:09PM -0800, Gary Kline wrote:
> > guys, i am appending a piece of gtk test code. it saves the
> > internal filename buffer for "espeak -f %s ifbuf" to run
> > on--to be the user's voice. if i set
> >
> > static char *prefix = "talk";
> >
> > then back up and enter another string in the box at the
> > bottom, strange things happen. Anybody know where i am
> > messing up?
>
> Strange things most likely occur after attempting to free the const
> string in entry_changed_cb()
>
> g_free(prefix);
>
> which was fine if prefix was NULL initially. You can use -Wwrite-strings
> to catch that.
your advice was right on target. i changed the gcc line,
then checked
if (prefix == NULL)
printf("NOT NULL\n")
early in main(). since i set prefix , the string printed to
stdout. long-story-short, my test program works the way i
want.
> Unforutnately, passing constant strings as various
> user-data-kind arguments or to g_hash_table_insets() then produces
> warnings too.
okay; i'll watch out!
>
> Also learn to use valgrind; it would show you this problem immediately.
>
a couple hours ago i installed valgrind and a front end.
The next thing on my to-try list is to get the
increase/decrease buttons together; this means reading up
on the hbox stuff. i found one example somewhere last week
and it looks tricky. --anyhow, thans for your keen
insights.
gary
> Yeti
>
--
Gary Kline kl...@thought.org http://www.thought.org Public Service Unix
Journey Toward the Dawn, E-Book: http://www.thought.org
The 8.57a release of Jottings: http://jottings.thought.org
Twenty-five years of service to the Unix community.
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list