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
This commit is contained in:
Rui Matos 2017-08-27 20:15:47 +02:00
parent 6ee793118a
commit 5622704b74

View file

@ -501,23 +501,32 @@ query_done (GFile *file,
GAsyncResult *res, GAsyncResult *res,
CcInfoOverviewPanel *self) CcInfoOverviewPanel *self)
{ {
CcInfoOverviewPanelPrivate *priv;
GFileInfo *info; GFileInfo *info;
GError *error = NULL; GError *error = NULL;
CcInfoOverviewPanelPrivate *priv = cc_info_overview_panel_get_instance_private (self);
info = g_file_query_filesystem_info_finish (file, res, &error); info = g_file_query_filesystem_info_finish (file, res, &error);
if (info != NULL) 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); priv->total_bytes += g_file_info_get_attribute_uint64 (info, G_FILE_ATTRIBUTE_FILESYSTEM_SIZE);
g_object_unref (info); g_object_unref (info);
} }
else else
{ {
char *path; if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
path = g_file_get_path (file); {
g_warning ("Failed to get filesystem free space for '%s': %s", path, error->message); g_error_free (error);
g_free (path); return;
g_error_free (error); }
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 */ /* And onto the next element */