[liboobs] Clear runlevels list before updating



commit bc6c3d7aac72e8211d33ba4c667392c6cbae76dc
Author: Milan Bouchet-Valat <nalimilan club fr>
Date:   Mon May 3 22:34:24 2010 +0200

    Clear runlevels list before updating
    
    Before that, we were adding the 6 runlevels again and again, on each update. This lead to bugs when committing services changes, because only the first occurrence was modified, and others were always set to 'stop'. Since each runlevel was committed several times, the last one was deciding of the final state of the service, which was 'stop'.
    
    The only known symptom of this was in time-admin, which is updating the services list when installing NTP support. See
    https://bugs.launchpad.net/ubuntu/+source/gnome-system-tools/+bug/551936

 oobs/oobs-servicesconfig.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/oobs/oobs-servicesconfig.c b/oobs/oobs-servicesconfig.c
index ced5e1c..0b162f8 100644
--- a/oobs/oobs-servicesconfig.c
+++ b/oobs/oobs-servicesconfig.c
@@ -147,6 +147,13 @@ create_runlevels_list_from_dbus_reply (OobsObject      *object,
 
   priv = OOBS_SERVICES_CONFIG (object)->_priv;
 
+  if (priv->runlevels)
+  {
+    g_list_foreach (priv->runlevels, (GFunc) free_runlevel, NULL);
+    g_list_free (priv->runlevels);
+    priv->runlevels = NULL;
+  }
+
   while (dbus_message_iter_get_arg_type (&iter) == DBUS_TYPE_STRING)
     {
       name = utils_get_string (&iter);



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