CSS provider memory problem


I have in aplication many widget which some times change color (as atention of working device). I stil use 
gtk_widget_override_color() function. I rewrite code to CSS-like styling for widgets. There is problem with 
I write simpy demonstration code:

int blink(GtkWidget *widget)
   static int flag=0;
   GtkStyleContext *style_context = gtk_widget_get_style_context(GTK_WIDGET(widget));
   GtkCssProvider *provider = gtk_css_provider_new();
   gtk_style_context_add_provider(style_context, GTK_STYLE_PROVIDER(provider), 
      gtk_css_provider_load_from_data(provider, "*{background: red;}", -1, NULL);
      flag = 0;
      gtk_css_provider_load_from_data(provider, "*{background: white;}", -1, NULL);
      flag = 1;

int main

        g_timeout_add(50, (GSourceFunc)blink, button);


After starting this code, constantly rise amount of alocated memory. It seems that every use of 
gtk_style_context_add_provider() add new provider, but the old one is not remove. Is there any way to remove 
the old provider or get pointer to old provider from widget and reuse this one? Or any other solution?

Thanks much.

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