From 49f7d379bc38aeeeb84cf98571d34a1a0ba28423 Mon Sep 17 00:00:00 2001 From: Rui Matos Date: Mon, 2 Jul 2012 04:05:09 +0200 Subject: [PATCH] region: Fix a couple of memory leaks Unref the GSettings object and build the GnomeXkbInfo only once. There's no need to free and keep rebuilding the latter since it doesn't keep any state and is a bit expensive to build. https://bugzilla.gnome.org/show_bug.cgi?id=662489 --- panels/region/gnome-region-panel-input.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/panels/region/gnome-region-panel-input.c b/panels/region/gnome-region-panel-input.c index 8520e962c..21f857286 100644 --- a/panels/region/gnome-region-panel-input.c +++ b/panels/region/gnome-region-panel-input.c @@ -870,7 +870,10 @@ setup_input_tabs (GtkBuilder *builder, GtkTreeSelection *selection; input_sources_settings = g_settings_new (GNOME_DESKTOP_INPUT_SOURCES_DIR); - xkb_info = gnome_xkb_info_new (); + g_object_weak_ref (G_OBJECT (builder), (GWeakNotify) g_object_unref, input_sources_settings); + + if (!xkb_info) + xkb_info = gnome_xkb_info_new (); #ifdef HAVE_IBUS ibus_init ();