[gnome-software/1644-opening-software-repositories-window-causes-software-to-crash-when-started-with] gs-fedora-third-party: Ensure error is set on failure
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software/1644-opening-software-repositories-window-causes-software-to-crash-when-started-with] gs-fedora-third-party: Ensure error is set on failure
- Date: Wed, 16 Feb 2022 09:45:37 +0000 (UTC)
commit c8ab4ede1f97f96fec135a506e5e3ce5b461d129
Author: Milan Crha <mcrha redhat com>
Date: Wed Feb 16 10:43:30 2022 +0100
gs-fedora-third-party: Ensure error is set on failure
When the 'fedora-third-party' call fails, like when it crashes, the GError
might not be set, thus make sure there is some always set on failure,
because the caller expects to have it set when the call fails.
Closes https://gitlab.gnome.org/GNOME/gnome-software/-/issues/1644
lib/gs-fedora-third-party.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
---
diff --git a/lib/gs-fedora-third-party.c b/lib/gs-fedora-third-party.c
index 98f16e70c..f7ccb1114 100644
--- a/lib/gs-fedora-third-party.c
+++ b/lib/gs-fedora-third-party.c
@@ -115,6 +115,13 @@ gs_fedora_third_party_invalidate (GsFedoraThirdParty *self)
g_mutex_unlock (&self->lock);
}
+static void
+gs_fedora_third_party_ensure_error (GError **error)
+{
+ if (error != NULL && *error == NULL)
+ g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_FAILED, "Failed to call
'fedora-third-party'");
+}
+
typedef struct _AsyncData
{
gboolean enable;
@@ -234,6 +241,9 @@ gs_fedora_third_party_query_sync (GsFedoraThirdParty *self,
}
g_mutex_unlock (&self->lock);
+ if (!success)
+ gs_fedora_third_party_ensure_error (error);
+
return success;
}
@@ -305,6 +315,9 @@ gs_fedora_third_party_switch_sync (GsFedoraThirdParty *self,
}
g_mutex_unlock (&self->lock);
+ if (!success)
+ gs_fedora_third_party_ensure_error (error);
+
return success;
}
@@ -370,6 +383,9 @@ gs_fedora_third_party_opt_out_sync (GsFedoraThirdParty *self,
}
g_mutex_unlock (&self->lock);
+ if (!success)
+ gs_fedora_third_party_ensure_error (error);
+
return success;
}
@@ -470,6 +486,9 @@ gs_fedora_third_party_list_sync (GsFedoraThirdParty *self,
*out_repos = g_hash_table_ref (self->repos);
g_mutex_unlock (&self->lock);
+ if (!success)
+ gs_fedora_third_party_ensure_error (error);
+
return success;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]