Re: GtkLabel question



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Havoc Pennington wrote:

|>How is the best solution to this? GtkLabel doesn't provide a function to
|>access directly to the pointer to free() it, and I don't think accessing
|>directly to the structure is a good idea.
| GTK never "adopts" a string you pass in; it makes a copy. You can
| free your string as soon as you've passed it in.

It's weird, memprof tells me that there's a memory leak when I do some
thing like:

- ------------------------------------------------------------
GtkLabel *label;
gint i;
...
gtk_label_set_text(label, g_strdup_printf("%d", i));
- ------------------------------------------------------------

If gtk_label_set_text() copies the string, isn't the string generated
with g_strdup_printf() freed automatically?

Regards,
- --
Lucas Di Pentima - Santa Fe, Argentina - ICQ UIN: 6782045
LUNIX: Soluciones en GNU/Linux - http://www.lunix.com.ar
GnuPG Public Key:
http://pks.lugli.org.ar:11371/pks/lookup?op=get&search=lucas lunix
Key fingerprint = BD3B 08C4 661A 8C3B 1855  740C 8F98 3FCF 6AA5 4FC9
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQE+yPt5j5g/z2qlT8kRAuwOAKDIcAHHaBPXBmftwSjXF9EmJ+nbNACg4TRV
TMciFOMYVEmFb1sDitI4UPM=
=OoAT
-----END PGP SIGNATURE-----




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