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,16 +501,24 @@ 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
{
if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
{
g_error_free (error);
return;
}
else
{
char *path;
@ -519,6 +527,7 @@ query_done (GFile *file,
g_free (path);
g_error_free (error);
}
}
/* And onto the next element */
get_primary_disc_info_start (self);