From be1232664307955bc4ecfe116dde3f9444106fa4 Mon Sep 17 00:00:00 2001 From: xiaoweiwei Date: Wed, 18 Mar 2020 20:43:33 +0800 Subject: [PATCH] fix crashes when retrieving disk size --- Fix-crashes-when-retrieving-disk-size.patch | 69 +++++++++++++++++++++ gnome-control-center.spec | 10 ++- 2 files changed, 77 insertions(+), 2 deletions(-) create mode 100644 Fix-crashes-when-retrieving-disk-size.patch diff --git a/Fix-crashes-when-retrieving-disk-size.patch b/Fix-crashes-when-retrieving-disk-size.patch new file mode 100644 index 0000000..82e9c8e --- /dev/null +++ b/Fix-crashes-when-retrieving-disk-size.patch @@ -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 diff --git a/gnome-control-center.spec b/gnome-control-center.spec index 0cf1b54..973e40f 100644 --- a/gnome-control-center.spec +++ b/gnome-control-center.spec @@ -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 - 3.30.1-9 +- Type:bugfix +- ID:NA +- SUG:NA +- DESC:fix crash when retrieving disk size + * Fri Mar 13 2020 openEuler Buildteam - 3.30.1-8 - Type:bugfix - ID:NA -- Gitee