[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.
This commit is contained in:
Thomas Wood 2009-07-12 00:38:26 +01:00
parent 91d7627558
commit dbbe37f0bc

View file

@ -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
{