[gnome-software] appstream: Fix plugin failing to load if applications directory doesn't exist
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] appstream: Fix plugin failing to load if applications directory doesn't exist
- Date: Mon, 23 Mar 2020 15:03:23 +0000 (UTC)
commit 52f1fa25a8150ea8f69c627c21e873a8b0cbb9bd
Author: Robert Ancell <robert ancell canonical com>
Date: Fri Mar 20 17:05:17 2020 +1300
appstream: Fix plugin failing to load if applications directory doesn't exist
Due to an ordering bug gs_plugin_appstream_load_desktop() can set a GError and return TRUE.
This causes the appstream plugin to hit an assertion and fail to start:
XbSilo xb_builder_ensure: assertion 'error == NULL || *error == NULL' failed
plugins/core/gs-plugin-appstream.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
---
diff --git a/plugins/core/gs-plugin-appstream.c b/plugins/core/gs-plugin-appstream.c
index 4d8ba517..037653c1 100644
--- a/plugins/core/gs-plugin-appstream.c
+++ b/plugins/core/gs-plugin-appstream.c
@@ -264,12 +264,17 @@ gs_plugin_appstream_load_desktop (GsPlugin *plugin,
GError **error)
{
const gchar *fn;
- g_autoptr(GDir) dir = g_dir_open (path, 0, error);
- g_autoptr(GFile) parent = g_file_new_for_path (path);
- if (!g_file_query_exists (parent, cancellable))
- return TRUE;
+ g_autoptr(GDir) dir = NULL;
+ g_autoptr(GFile) parent = NULL;
+
+ dir = g_dir_open (path, 0, error);
if (dir == NULL)
return FALSE;
+
+ parent = g_file_new_for_path (path);
+ if (!g_file_query_exists (parent, cancellable))
+ return TRUE;
+
while ((fn = g_dir_read_name (dir)) != NULL) {
if (g_str_has_suffix (fn, ".desktop")) {
g_autofree gchar *filename = g_build_filename (path, fn, NULL);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]