[EMAIL PROTECTED] writes:
> Hi,
>
>
> I use the gtk_style_new() in a function to update every 1 seconds the color
> of a entry (see below).
>
> The function works fine except it eats some memory every it is called (I
> can monitor this with top command).
> Do I have to to a free (style) ???
>
> Thank you
>
> void SetEntryBackgroundColor( * GtkWidget * Entry, gint color)
> {
>
> GdkColor red = {0, 65335, 0, 0};
> GdkColor blue = {0, 0, 0, 65335};
> GdkColor green = {0, 0, 0, 65335};
>
> GtkStyle * style;
>
> style=gtk_style_new();
This really should be 'style = gtk_style_copy (entry->style)',
or you'll completely ignore the user's settings.
>
> switch(color)
> {
> case RED:
> style->base[GTK_STATE_NORMAL] = red;
> break;
>
> case BLUE:
> style->base[GTK_STATE_NORMAL] = blue;
> break;
>
> case GREEN:
> style->base[GTK_STATE_NORMAL] = green;
> break;
> }
>
> gtk_widget_set_style(entry,style);
Add, here, 'gtk_style_unref (style)'. Otherwise, you will
continue to hold a reference to the style and it will,
not suprisingly, never be freed.
Owen
_______________________________________________
Glade-devel maillist - [EMAIL PROTECTED]
http://lists.helixcode.com/mailman/listinfo/glade-devel