[gnome-control-center] region: Fix a couple of memory leaks



commit 49f7d379bc38aeeeb84cf98571d34a1a0ba28423
Author: Rui Matos <tiagomatos gmail com>
Date:   Mon Jul 2 04:05:09 2012 +0200

    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 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/panels/region/gnome-region-panel-input.c b/panels/region/gnome-region-panel-input.c
index 8520e96..21f8572 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 ();



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