[gnome-software] plugin loader: Don't crash when refine fails in one plugin



commit 69721a8fdf0fef6b3f1ee645b9ab2b868d5e8d62
Author: Kalev Lember <klember redhat com>
Date:   Mon Jul 4 14:45:30 2016 +0200

    plugin loader: Don't crash when refine fails in one plugin
    
    When we iterate over plugins and ignore errors with the error_local
    pattern, make sure to also ignore return values, to avoid accidentally
    returning FALSE without an error set.

 src/gs-plugin-loader.c |   16 ++++++++++------
 1 files changed, 10 insertions(+), 6 deletions(-)
---
diff --git a/src/gs-plugin-loader.c b/src/gs-plugin-loader.c
index f9ff859..520feb3 100644
--- a/src/gs-plugin-loader.c
+++ b/src/gs-plugin-loader.c
@@ -337,11 +337,13 @@ gs_plugin_loader_run_refine_internal (GsPluginLoader *plugin_loader,
                /* run the batched plugin symbol then the per-app plugin */
                if (plugin_func != NULL) {
                        g_autoptr(GError) error_local = NULL;
+                       gboolean ret_local;
+
                        gs_plugin_loader_action_start (plugin_loader, plugin, FALSE);
-                       ret = plugin_func (plugin, list, flags,
-                                          cancellable, &error_local);
+                       ret_local = plugin_func (plugin, list, flags,
+                                                cancellable, &error_local);
                        gs_plugin_loader_action_stop (plugin_loader, plugin);
-                       if (!ret) {
+                       if (!ret_local) {
                                /* badly behaved plugin */
                                if (error_local == NULL) {
                                        g_critical ("%s did not set error for %s",
@@ -359,12 +361,14 @@ gs_plugin_loader_run_refine_internal (GsPluginLoader *plugin_loader,
                if (plugin_app_func != NULL) {
                        for (j = 0; j < gs_app_list_length (list); j++) {
                                g_autoptr(GError) error_local = NULL;
+                               gboolean ret_local;
+
                                app = gs_app_list_index (list, j);
                                gs_plugin_loader_action_start (plugin_loader, plugin, FALSE);
-                               ret = plugin_app_func (plugin, app, flags,
-                                                      cancellable, &error_local);
+                               ret_local = plugin_app_func (plugin, app, flags,
+                                                            cancellable, &error_local);
                                gs_plugin_loader_action_stop (plugin_loader, plugin);
-                               if (!ret) {
+                               if (!ret_local) {
                                        /* badly behaved plugin */
                                        if (error_local == NULL) {
                                                g_critical ("%s did not set error for %s",


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