fix crashes when retrieving disk size

This commit is contained in:
xiaoweiwei 2020-03-18 20:43:33 +08:00
parent 5e274e586e
commit be12326643
2 changed files with 77 additions and 2 deletions

View File

@ -0,0 +1,69 @@
---
panels/info/cc-info-overview-panel.c | 33 +++++++++++++++++++++++-----
1 file changed, 28 insertions(+), 5 deletions(-)
diff --git a/panels/info/cc-info-overview-panel.c b/panels/info/cc-info-overview-panel.c
index 7758271b1..fa9510b06 100644
--- a/panels/info/cc-info-overview-panel.c
+++ b/panels/info/cc-info-overview-panel.c
@@ -546,10 +546,30 @@ get_primary_disc_info_start (CcInfoOverviewPanel *self)
self);
}
+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 (CcInfoOverviewPanel *self)
{
- GList *points;
+ GList *points, *entries = NULL;
GList *p;
GHashTable *hash;
CcInfoOverviewPanelPrivate *priv = cc_info_overview_panel_get_instance_private (self);
@@ -557,11 +577,14 @@ get_primary_disc_info (CcInfoOverviewPanel *self)
hash = g_hash_table_new (g_str_hash, g_str_equal);
points = g_unix_mount_points_get (NULL);
+ entries = convert_points_to_entries (points);
+ g_list_free_full (points, (GDestroyNotify) g_unix_mount_point_free);
+
/* If we do not have /etc/fstab around, try /etc/mtab */
- if (points == NULL)
- points = g_unix_mounts_get (NULL);
+ if (entries == NULL)
+ entries = g_unix_mounts_get (NULL);
- for (p = points; p != NULL; p = p->next)
+ for (p = entries; p != NULL; p = p->next)
{
GUnixMountEntry *mount = p->data;
const char *mount_path;
@@ -586,7 +609,7 @@ get_primary_disc_info (CcInfoOverviewPanel *self)
priv->primary_mounts = g_list_prepend (priv->primary_mounts, mount);
g_hash_table_insert (hash, (gpointer) device_path, (gpointer) device_path);
}
- g_list_free (points);
+ g_list_free (entries);
g_hash_table_destroy (hash);
priv->cancellable = g_cancellable_new ();
--
2.24.1

View File

@ -1,8 +1,7 @@
Name: gnome-control-center
Version: 3.30.1
Release: 8
Release: 9
Summary: GNOME Settings is GNOME's main interface for configuration of various aspects of your desktop.
License: GPLv2+ and CC-BY-SA
URL: http://www.gnome.org
Source0: https://github.com/GNOME/gnome-control-center/releases/tag/%{name}-%{version}.tar.xz
@ -39,6 +38,7 @@ Patch9002: bugfix-fix_used_passwd_error_capture.patch
Patch9003: gnome-control-center-change-translation-when-changing-password.patch
Patch9004: bugfix-duplicate-Current-passwd.patch
Patch9005: gnome-control-center-remove-country-in-the-name-of-timezone.patch
Patch9006: Fix-crashes-when-retrieving-disk-size.patch
%description
Gnome-control-center is a graphical user interface to configure
@ -103,6 +103,12 @@ chrpath --delete %{buildroot}%{_bindir}/gnome-control-center
%{_mandir}/man1/*.gz
%changelog
* Wed Mar 18 2020 openEuler Buildteam<buildteam@openeuler.org> - 3.30.1-9
- Type:bugfix
- ID:NA
- SUG:NA
- DESC:fix crash when retrieving disk size
* Fri Mar 13 2020 openEuler Buildteam<buildteam@openeuler.org> - 3.30.1-8
- Type:bugfix
- ID:NA