Re: Why cani i initialize "prefix" with a default string?
- From: David NeÄas <yeti physics muni cz>
- To: Gary Kline <kline thought org>
- Cc: GTK Devel List <gtk-app-devel-list gnome org>
- Subject: Re: Why cani i initialize "prefix" with a default string?
- Date: Sat, 10 Dec 2011 03:23:10 +0100
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. Unforutnately, passing constant strings as various
user-data-kind arguments or to g_hash_table_insets() then produces
warnings too.
Also learn to use valgrind; it would show you this problem immediately.
Yeti
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]