[gnome-builder] xml-pack: extra protect against non-existing schema
- From: Sébastien Lafargue <slafargue src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] xml-pack: extra protect against non-existing schema
- Date: Tue, 18 Jul 2017 22:43:04 +0000 (UTC)
commit 96113060ffc87d8ed0d4bbbfc9db4074333e6f23
Author: Sebastien Lafargue <slafargue gnome org>
Date: Wed Jul 19 00:35:49 2017 +0200
xml-pack: extra protect against non-existing schema
plugins/xml-pack/ide-xml-service.c | 24 +++++++++++++++++++-----
1 files changed, 19 insertions(+), 5 deletions(-)
---
diff --git a/plugins/xml-pack/ide-xml-service.c b/plugins/xml-pack/ide-xml-service.c
index 1d8da3b..da4e857 100644
--- a/plugins/xml-pack/ide-xml-service.c
+++ b/plugins/xml-pack/ide-xml-service.c
@@ -183,20 +183,34 @@ ide_xml_service_load_schema_cb2 (GObject *object,
{
GFile *file = (GFile *)object;
SchemaState *state = (SchemaState *)user_data;
+ IdeXmlSchemaCacheEntry *cache_entry;
g_autoptr (GFileInfo) file_info = NULL;
+ GTask *task;
GError *error = NULL;
g_assert (G_IS_FILE (file));
g_assert (G_IS_TASK (result));
g_assert (state != NULL);
+ task = state->task;
+ cache_entry = state->cache_entry;
if (NULL != (file_info = g_file_query_info_finish (file, result, &error)))
- state->cache_entry->mtime = g_file_info_get_attribute_uint64 (file_info, G_FILE_ATTRIBUTE_TIME_MODIFIED);
+ {
+ cache_entry->mtime = g_file_info_get_attribute_uint64 (file_info, G_FILE_ATTRIBUTE_TIME_MODIFIED);
+ g_file_load_contents_async (file,
+ g_task_get_cancellable (state->task),
+ ide_xml_service_load_schema_cb3,
+ state);
+ }
+ else
+ {
+ cache_entry->error_message = g_strdup (error->message);
+ cache_entry->state = SCHEMA_STATE_CANT_LOAD;
- g_file_load_contents_async (file,
- g_task_get_cancellable (state->task),
- ide_xml_service_load_schema_cb3,
- state);
+ g_object_unref (state->task);
+ g_slice_free (SchemaState, state);
+ g_task_return_pointer (task, cache_entry, (GDestroyNotify)ide_xml_schema_cache_entry_unref);
+ }
}
/* Get mtime phase */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]