[gnome-control-center] info: Avoid a crash when we're cancelled
- From: Rui Matos <rtcm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] info: Avoid a crash when we're cancelled
- Date: Mon, 28 Aug 2017 16:59:03 +0000 (UTC)
commit 5622704b74bb73f4fa5cf33825d85a5a6670533f
Author: Rui Matos <tiagomatos gmail com>
Date: Sun Aug 27 20:15:47 2017 +0200
info: Avoid a crash when we're cancelled
If we're cancelled, the panel is being finalized so return immediately
instead of iterating further and crashing.
https://bugzilla.gnome.org/show_bug.cgi?id=786097
panels/info/cc-info-overview-panel.c | 21 +++++++++++++++------
1 files changed, 15 insertions(+), 6 deletions(-)
---
diff --git a/panels/info/cc-info-overview-panel.c b/panels/info/cc-info-overview-panel.c
index 163d006..3af58be 100644
--- a/panels/info/cc-info-overview-panel.c
+++ b/panels/info/cc-info-overview-panel.c
@@ -501,23 +501,32 @@ query_done (GFile *file,
GAsyncResult *res,
CcInfoOverviewPanel *self)
{
+ CcInfoOverviewPanelPrivate *priv;
GFileInfo *info;
GError *error = NULL;
- CcInfoOverviewPanelPrivate *priv = cc_info_overview_panel_get_instance_private (self);
info = g_file_query_filesystem_info_finish (file, res, &error);
if (info != NULL)
{
+ priv = cc_info_overview_panel_get_instance_private (self);
priv->total_bytes += g_file_info_get_attribute_uint64 (info, G_FILE_ATTRIBUTE_FILESYSTEM_SIZE);
g_object_unref (info);
}
else
{
- char *path;
- path = g_file_get_path (file);
- g_warning ("Failed to get filesystem free space for '%s': %s", path, error->message);
- g_free (path);
- g_error_free (error);
+ if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
+ {
+ g_error_free (error);
+ return;
+ }
+ else
+ {
+ char *path;
+ path = g_file_get_path (file);
+ g_warning ("Failed to get filesystem free space for '%s': %s", path, error->message);
+ g_free (path);
+ g_error_free (error);
+ }
}
/* And onto the next element */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]