[gtk+/composite-templates] GtkSettings: Properly clean up style providers



commit 73963fb42f537d05019691c8c43a3a9a190341b9
Author: Matthias Clasen <mclasen redhat com>
Date:   Mon Sep 17 22:30:14 2012 -0400

    GtkSettings: Properly clean up style providers

 gtk/gtksettings.c |   13 ++++++-------
 1 files changed, 6 insertions(+), 7 deletions(-)
---
diff --git a/gtk/gtksettings.c b/gtk/gtksettings.c
index cfcc192..5da0ff2 100644
--- a/gtk/gtksettings.c
+++ b/gtk/gtksettings.c
@@ -253,6 +253,9 @@ static GHashTable *get_color_hash                (GtkSettings           *setting
 static void gtk_settings_load_from_key_file      (GtkSettings           *settings,
                                                   const gchar           *path,
                                                   GtkSettingsSource      source);
+static void settings_update_provider             (GdkScreen             *screen,
+                                                  GtkCssProvider       **old,
+                                                  GtkCssProvider        *new);
 
 /* the default palette for GtkColorSelelection */
 static const gchar default_color_palette[] =
@@ -1568,14 +1571,10 @@ gtk_settings_finalize (GObject *object)
 
   g_datalist_clear (&priv->queued_settings);
 
-  if (priv->theme_provider)
-    g_object_unref (priv->theme_provider);
+  settings_update_provider (priv->screen, &priv->theme_provider, NULL);
+  settings_update_provider (priv->screen, &priv->key_theme_provider, NULL);
 
-  if (priv->key_theme_provider)
-    g_object_unref (priv->key_theme_provider);
-
-  if (priv->style)
-    g_object_unref (priv->style);
+  g_clear_object (&priv->style);
 
   G_OBJECT_CLASS (gtk_settings_parent_class)->finalize (object);
 }



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