Khurshid Alam has proposed merging 
lp:~khurshid-alam/unity-control-center/info-panel-fix into 
lp:unity-control-center.

Commit message:
info: Fix crashes when retrieving disk size
The panel crashes against glib >= 2,59.2 because GUnixMountPoint is by mistake 
used as GUnixMountEntry.

See https://gitlab.gnome.org/GNOME/gnome-control-center/merge_requests/432

Requested reviews:
  Sebastien Bacher (seb128)
Related bugs:
  Bug #1819368 in unity-control-center (Ubuntu): "unity-control-center crashed 
with SIGSEGV in free()"
  https://bugs.launchpad.net/ubuntu/+source/unity-control-center/+bug/1819368

For more details, see:
https://code.launchpad.net/~khurshid-alam/unity-control-center/info-panel-fix/+merge/364613
-- 
Your team Unity Control Center development team is subscribed to branch 
lp:unity-control-center.
=== modified file 'panels/info/cc-info-panel.c'
--- panels/info/cc-info-panel.c	2016-06-12 12:50:32 +0000
+++ panels/info/cc-info-panel.c	2019-03-16 07:33:01 +0000
@@ -579,14 +579,38 @@
   g_object_unref (file);
 }
 
+static GList *
+convert_points_to_entries (GList *points)
+{
+  GList *entries = NULL;
+  GList *p;
+
+  for (p = points; p != NULL; p = p->next)
+    {
+      GUnixMountPoint *point = p->data;
+      GUnixMountEntry *mount;
+      const gchar *mount_path = g_unix_mount_point_get_mount_path (point);
+
+      mount = g_unix_mount_at (mount_path, NULL);
+      if (mount)
+        entries = g_list_append (entries, mount);
+    }
+
+  return entries;
+}
+
 static void
 get_primary_disc_info (CcInfoPanel *self)
 {
-  GList        *points;
-  GList        *p;
+  GList *points, *entries = NULL;
+  GList *p;
 
   points = g_unix_mount_points_get (NULL);
-  for (p = points; p != NULL; p = p->next)
+
+  entries = convert_points_to_entries (points);
+  g_list_free_full (points, (GDestroyNotify) g_unix_mount_point_free);
+
+  for (p = entries; p != NULL; p = p->next)
     {
       GUnixMountEntry *mount = p->data;
       const char *mount_path;
@@ -604,7 +628,7 @@
 
       self->priv->primary_mounts = g_list_prepend (self->priv->primary_mounts, mount);
     }
-  g_list_free (points);
+  g_list_free (entries);
 
   get_primary_disc_info_start (self);
 }

-- 
ubuntu-desktop mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-desktop

Reply via email to