Re: GtkLabel question
- From: Havoc Pennington <hp redhat com>
- To: Lucas Di Pentima <lucas lunix com ar>
- Cc: GNOME Devel List <gnome-devel-list gnome org>
- Subject: Re: GtkLabel question
- Date: Mon, 19 May 2003 10:50:11 -0400
On Mon, May 19, 2003 at 11:41:24AM -0300, Lucas Di Pentima wrote:
> I'm having some doubts about the GtkLabel widget: I'm using this widget
> to show changing information to the user, every time I need to change
> the information shown on the labels, I use the gtk_label_set_text()
> function passing a newly allocated string.
>
> The problem is that it seems that GtkLabel doesn't free() those strings
> when I assign a new one to them, so my program has many memory leaks, I
> checked it with Memprof.
>
> 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.
Havoc
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]