Merge lp:~khurshid-alam/unity-control-center/info-panel-fix into lp:unity-control-center

Proposed by Khurshid Alam on 2019-03-16
Status: Merged
Approved by: Sebastien Bacher on 2019-04-01
Approved revision: 12920
Merged at revision: 12920
Proposed branch: lp:~khurshid-alam/unity-control-center/info-panel-fix
Merge into: lp:unity-control-center
Diff against target: 54 lines (+28/-4)
1 file modified
panels/info/cc-info-panel.c (+28/-4)
To merge this branch: bzr merge lp:~khurshid-alam/unity-control-center/info-panel-fix
Reviewer Review Type Date Requested Status
Sebastien Bacher 2019-03-16 Approve on 2019-04-01
Review via email: mp+364613@code.launchpad.net

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

To post a comment you must log in.
Sebastien Bacher (seb128) wrote :

looks fine indeed

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'panels/info/cc-info-panel.c'
2--- panels/info/cc-info-panel.c 2016-06-12 12:50:32 +0000
3+++ panels/info/cc-info-panel.c 2019-03-16 07:33:01 +0000
4@@ -579,14 +579,38 @@
5 g_object_unref (file);
6 }
7
8+static GList *
9+convert_points_to_entries (GList *points)
10+{
11+ GList *entries = NULL;
12+ GList *p;
13+
14+ for (p = points; p != NULL; p = p->next)
15+ {
16+ GUnixMountPoint *point = p->data;
17+ GUnixMountEntry *mount;
18+ const gchar *mount_path = g_unix_mount_point_get_mount_path (point);
19+
20+ mount = g_unix_mount_at (mount_path, NULL);
21+ if (mount)
22+ entries = g_list_append (entries, mount);
23+ }
24+
25+ return entries;
26+}
27+
28 static void
29 get_primary_disc_info (CcInfoPanel *self)
30 {
31- GList *points;
32- GList *p;
33+ GList *points, *entries = NULL;
34+ GList *p;
35
36 points = g_unix_mount_points_get (NULL);
37- for (p = points; p != NULL; p = p->next)
38+
39+ entries = convert_points_to_entries (points);
40+ g_list_free_full (points, (GDestroyNotify) g_unix_mount_point_free);
41+
42+ for (p = entries; p != NULL; p = p->next)
43 {
44 GUnixMountEntry *mount = p->data;
45 const char *mount_path;
46@@ -604,7 +628,7 @@
47
48 self->priv->primary_mounts = g_list_prepend (self->priv->primary_mounts, mount);
49 }
50- g_list_free (points);
51+ g_list_free (entries);
52
53 get_primary_disc_info_start (self);
54 }

Subscribers

People subscribed via source and target branches