[gnome-settings-daemon] xrandr: Free GnomeRRConfigs on stop



commit 6152d021bbeef7ef2197e44ed576f1db374012ad
Author: Rui Matos <tiagomatos gmail com>
Date:   Fri Nov 14 23:24:23 2014 +0100

    xrandr: Free GnomeRRConfigs on stop
    
    They won't leak if the plugin is stopped and started again but they do
    if we reach finalize() which isn't really a problem but there's no
    reason to keep them around anyway.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=740151

 plugins/xrandr/gsd-xrandr-manager.c |   22 +++++++++++++++-------
 1 files changed, 15 insertions(+), 7 deletions(-)
---
diff --git a/plugins/xrandr/gsd-xrandr-manager.c b/plugins/xrandr/gsd-xrandr-manager.c
index 9b2519a..007beab 100644
--- a/plugins/xrandr/gsd-xrandr-manager.c
+++ b/plugins/xrandr/gsd-xrandr-manager.c
@@ -893,14 +893,8 @@ sanitize (GsdXrandrManager *manager, GPtrArray *array)
 }
 
 static void
-generate_fn_f7_configs (GsdXrandrManager *mgr)
+free_fn_f7_configs (GsdXrandrManager *mgr)
 {
-        GPtrArray *array = g_ptr_array_new ();
-        GnomeRRScreen *screen = mgr->priv->rw_screen;
-
-        g_debug ("Generating configurations");
-
-        /* Free any existing list of configurations */
         if (mgr->priv->fn_f7_configs) {
                 int i;
 
@@ -911,6 +905,18 @@ generate_fn_f7_configs (GsdXrandrManager *mgr)
                 mgr->priv->fn_f7_configs = NULL;
                 mgr->priv->current_fn_f7_config = -1;
         }
+}
+
+static void
+generate_fn_f7_configs (GsdXrandrManager *mgr)
+{
+        GPtrArray *array = g_ptr_array_new ();
+        GnomeRRScreen *screen = mgr->priv->rw_screen;
+
+        g_debug ("Generating configurations");
+
+        /* Free any existing list of configurations */
+        free_fn_f7_configs (mgr);
 
         g_ptr_array_add (array, gnome_rr_config_new_current (screen, NULL));
         g_ptr_array_add (array, make_clone_setup (mgr, screen));
@@ -1295,6 +1301,8 @@ gsd_xrandr_manager_stop (GsdXrandrManager *manager)
                 manager->priv->device_manager = NULL;
         }
 
+        free_fn_f7_configs (manager);
+
         log_open ();
         log_msg ("STOPPING XRANDR PLUGIN\n------------------------------------------------------------\n");
         log_close ();


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