← Back to team overview

ayatana-commits team mailing list archive

[Merge] lp:~jjardon/indicator-datetime/fix-844741 into lp:indicator-datetime

 

Javier Jardón has proposed merging lp:~jjardon/indicator-datetime/fix-844741 into lp:indicator-datetime.

Requested reviews:
  Indicator Applet Developers (indicator-applet-developers)
Related bugs:
  Bug #844741 in Indicator Date and Time: "gnome-control-center crashed with SIGABRT in raise()"
  https://bugs.launchpad.net/indicator-datetime/+bug/844741

For more details, see:
https://code.launchpad.net/~jjardon/indicator-datetime/fix-844741/+merge/77735
-- 
https://code.launchpad.net/~jjardon/indicator-datetime/fix-844741/+merge/77735
Your team ayatana-commits is subscribed to branch lp:indicator-datetime.
=== modified file 'src/timezone-completion.c'
--- src/timezone-completion.c	2011-09-06 12:47:37 +0000
+++ src/timezone-completion.c	2011-09-30 16:31:37 +0000
@@ -44,6 +44,7 @@
   guint          keypress_id;
   GCancellable * cancel;
   gchar *        request_text;
+  gchar *        version;
   GHashTable *   request_table;
 };
 
@@ -312,19 +313,16 @@
 }
 
 static gchar *
-get_version (void)
+get_version (TimezoneCompletion *self)
 {
-  static gchar *version = NULL;
-
-  if (version == NULL) {
-    gchar *stdout = NULL;
-    g_spawn_command_line_sync ("lsb_release -rs", &stdout, NULL, NULL, NULL);
-
-    if (stdout != NULL)
-      version = g_strstrip (stdout);
-    else
-      version = g_strdup("");
-  }
+  gchar *version = NULL;
+
+  g_spawn_command_line_sync ("lsb_release -rs", &version, NULL, NULL, NULL);
+
+  if (version != NULL)
+    version = g_strstrip (version);
+  else
+    version = g_strdup("");
 
   return version;
 }
@@ -351,11 +349,9 @@
   priv->request_text = g_strdup (text);
 
   gchar * escaped = g_uri_escape_string (text, NULL, FALSE);
-  gchar * version = get_version ();
   gchar * locale = get_locale ();
-  gchar * url = g_strdup_printf (GEONAME_URL, escaped, version, locale);
+  gchar * url = g_strdup_printf (GEONAME_URL, escaped, priv->version, locale);
   g_free (locale);
-  g_free (version);
   g_free (escaped);
 
   GFile * file =  g_file_new_for_uri (url);
@@ -609,6 +605,7 @@
   priv = self->priv;
 
   priv->initial_model = GTK_TREE_MODEL (get_initial_model ());
+  priv->version = get_version (self);
 
   g_object_set (G_OBJECT (self),
                 "text-column", TIMEZONE_COMPLETION_NAME,
@@ -673,6 +670,11 @@
     priv->request_text = NULL;
   }
 
+  if (priv->version != NULL) {
+    g_free (priv->version);
+    priv->version = NULL;
+  }
+
   if (priv->request_table != NULL) {
     g_hash_table_destroy (priv->request_table);
     priv->request_table = NULL;


Follow ups