[gnome-software/gnome-3-26] flatpak: Ensure apps being used are GsFlatpakApps
- From: Kalev Lember <klember src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software/gnome-3-26] flatpak: Ensure apps being used are GsFlatpakApps
- Date: Thu, 9 Nov 2017 14:35:42 +0000 (UTC)
commit e94306abbfb77ede0b3ba6fbc4b5d3221538f56c
Author: Joaquim Rocha <jrocha endlessm com>
Date: Tue Sep 5 12:05:54 2017 +0200
flatpak: Ensure apps being used are GsFlatpakApps
This patch checks if the apps in use are GsFlatpakApps since apparently
under certain conditions plain GsApp objects were being given to
the Flatpak plugin and, when using them as GsFlatpakApps, it would
segfault.
plugins/flatpak/gs-flatpak.c | 12 +++++++++---
plugins/flatpak/gs-plugin-flatpak.c | 6 ++----
2 files changed, 11 insertions(+), 7 deletions(-)
---
diff --git a/plugins/flatpak/gs-flatpak.c b/plugins/flatpak/gs-flatpak.c
index 4d4ddd0..a3ee236 100644
--- a/plugins/flatpak/gs-flatpak.c
+++ b/plugins/flatpak/gs-flatpak.c
@@ -127,10 +127,16 @@ gs_flatpak_create_app (GsFlatpak *self, FlatpakRef *xref)
app = gs_plugin_app_new (self->plugin, id);
gs_flatpak_set_metadata (self, app, xref);
- /* we already have one, returned the ref'd cached copy */
+ /* we already have one and it's a Flatpak app, return the ref'd cached copy */
app_cached = gs_plugin_cache_lookup (self->plugin, gs_app_get_unique_id (app));
- if (app_cached != NULL)
- return app_cached;
+ if (app_cached != NULL) {
+ if (GS_IS_FLATPAK_APP (app_cached)) {
+ return app_cached;
+ } else {
+ g_warning ("Found cached app in Flatpak plugin that is not a Flatpak app: %s; ",
+ gs_app_get_unique_id (app_cached));
+ }
+ }
/* fallback values */
if (gs_app_get_kind (app) == AS_APP_KIND_RUNTIME) {
diff --git a/plugins/flatpak/gs-plugin-flatpak.c b/plugins/flatpak/gs-plugin-flatpak.c
index ecfb318..7827f3b 100644
--- a/plugins/flatpak/gs-plugin-flatpak.c
+++ b/plugins/flatpak/gs-plugin-flatpak.c
@@ -281,11 +281,9 @@ gs_plugin_flatpak_get_handler (GsPlugin *plugin, GsApp *app)
GsPluginData *priv = gs_plugin_get_data (plugin);
const gchar *object_id;
- /* only process this app if was created by this plugin */
- if (g_strcmp0 (gs_app_get_management_plugin (app),
- gs_plugin_get_name (plugin)) != 0) {
+ /* only process this app if it is a Flatpak app */
+ if (!GS_IS_FLATPAK_APP (app))
return NULL;
- }
/* specified an explicit name */
object_id = gs_flatpak_app_get_object_id (app);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]