termite.cc: pull out a method call into a variable so we can free it

This commit is contained in:
Daniel Lockyer 2016-05-05 19:44:28 +01:00
parent caa784a26c
commit f196f62ec9
1 changed files with 3 additions and 1 deletions

View File

@ -168,8 +168,10 @@ static std::function<void ()> reload_config;
static void override_background_color(GtkWidget *widget, GdkRGBA *rgba) { static void override_background_color(GtkWidget *widget, GdkRGBA *rgba) {
GtkCssProvider *provider = gtk_css_provider_new(); GtkCssProvider *provider = gtk_css_provider_new();
char *css = g_strdup_printf("* { background-color: %s; }", gdk_rgba_to_string(rgba)); gchar *colorstr = gdk_rgba_to_string(rgba);
char *css = g_strdup_printf("* { background-color: %s; }", colorstr);
gtk_css_provider_load_from_data(provider, css, -1, nullptr); gtk_css_provider_load_from_data(provider, css, -1, nullptr);
g_free(colorstr);
g_free(css); g_free(css);
gtk_style_context_add_provider(gtk_widget_get_style_context(widget), gtk_style_context_add_provider(gtk_widget_get_style_context(widget),