[gnome-software] Don't crash when refreshing the list of shell extensions



commit 4d88dc64787950eda4f120982e0f056f7f82770d
Author: Richard Hughes <richard hughsie com>
Date:   Mon Jun 13 16:07:56 2016 +0100

    Don't crash when refreshing the list of shell extensions
    
    By calling the public symbol the linker does the sensible thing of just using
    the first symbol name it finds from any of the plugins. This means the
    shell-extensions plugin was calling the flatpak gs_plugin_refresh() with the
    wrong private pointer with hilarious results.

 src/plugins/gs-plugin-shell-extensions.c |   34 ++++++++++++++++++++++--------
 1 files changed, 25 insertions(+), 9 deletions(-)
---
diff --git a/src/plugins/gs-plugin-shell-extensions.c b/src/plugins/gs-plugin-shell-extensions.c
index a97561d..61dff42 100644
--- a/src/plugins/gs-plugin-shell-extensions.c
+++ b/src/plugins/gs-plugin-shell-extensions.c
@@ -674,12 +674,12 @@ gs_plugin_shell_extensions_get_apps (GsPlugin *plugin,
        return apps;
 }
 
-gboolean
-gs_plugin_refresh (GsPlugin *plugin,
-                  guint cache_age,
-                  GsPluginRefreshFlags flags,
-                  GCancellable *cancellable,
-                  GError **error)
+static gboolean
+gs_plugin_shell_extensions_refresh (GsPlugin *plugin,
+                                   guint cache_age,
+                                   GsPluginRefreshFlags flags,
+                                   GCancellable *cancellable,
+                                   GError **error)
 {
        AsApp *app;
        guint i;
@@ -737,6 +737,20 @@ gs_plugin_refresh (GsPlugin *plugin,
 }
 
 gboolean
+gs_plugin_refresh (GsPlugin *plugin,
+                  guint cache_age,
+                  GsPluginRefreshFlags flags,
+                  GCancellable *cancellable,
+                  GError **error)
+{
+       return gs_plugin_shell_extensions_refresh (plugin,
+                                                  cache_age,
+                                                  flags,
+                                                  cancellable,
+                                                  error);
+}
+
+gboolean
 gs_plugin_app_remove (GsPlugin *plugin,
                      GsApp *app,
                      GCancellable *cancellable,
@@ -877,7 +891,9 @@ gs_plugin_add_categories (GsPlugin *plugin,
                          GError **error)
 {
        /* just ensure there is any data, no matter how old */
-       return gs_plugin_refresh (plugin, G_MAXUINT,
-                                 GS_PLUGIN_REFRESH_FLAGS_NONE,
-                                 cancellable, error);
+       return gs_plugin_shell_extensions_refresh (plugin,
+                                                  G_MAXUINT,
+                                                  GS_PLUGIN_REFRESH_FLAGS_NONE,
+                                                  cancellable,
+                                                  error);
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]