[gnome-control-center] [appearance] unref the GtkBuilder object if loading failed



commit dbbe37f0bc3e01e45588d042c73200a9e5dbcb24
Author: Thomas Wood <thos gnome org>
Date:   Sun Jul 12 00:38:26 2009 +0100

    [appearance] unref the GtkBuilder object if loading failed
    
    Unref the GtkBuilder object if the ui description file could not be loaded.
    This prevents the GtkBuilder object from being leaked.

 capplets/appearance/appearance-main.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/capplets/appearance/appearance-main.c b/capplets/appearance/appearance-main.c
index 99faeee..369af02 100644
--- a/capplets/appearance/appearance-main.c
+++ b/capplets/appearance/appearance-main.c
@@ -46,7 +46,7 @@ init_appearance_data (int *argc, char ***argv, GOptionContext *context)
   /* set up the data */
   uifile = g_build_filename (GNOMECC_GTKBUILDER_DIR, "appearance.ui",
                              NULL);
-  ui = gtk_builder_new();
+  ui = gtk_builder_new ();
   gtk_builder_add_from_file (ui, uifile, &err);
   g_free (uifile);
 
@@ -54,6 +54,7 @@ init_appearance_data (int *argc, char ***argv, GOptionContext *context)
     {
       g_warning (_("Could not load user interface file: %s"), err->message);
       g_error_free (err);
+      g_object_unref (ui);
     }
   else
     {



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