[gnome-software/wip/hughsie/shell-no-version] shell-extensions: Disable the plugin if we can't get the current shell version



commit b3af732e7711d3d94463b63595bfdb7fd7d2afa2
Author: Richard Hughes <richard hughsie com>
Date:   Tue Apr 9 12:46:50 2019 +0100

    shell-extensions: Disable the plugin if we can't get the current shell version
    
    This may explain the thousands of critical warnings and memory explosion in
    https://gitlab.gnome.org/GNOME/gnome-software/issues/486
    
    Relevant parts of the log:
    
        json_object_has_member: assertion 'member_name != NULL' failed
        g_strsplit: assertion 'string != NULL' failed
        g_strv_length: assertion 'str_array != NULL' failed

 plugins/shell-extensions/gs-plugin-shell-extensions.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/plugins/shell-extensions/gs-plugin-shell-extensions.c 
b/plugins/shell-extensions/gs-plugin-shell-extensions.c
index 6c2f1fd4..1c021873 100644
--- a/plugins/shell-extensions/gs-plugin-shell-extensions.c
+++ b/plugins/shell-extensions/gs-plugin-shell-extensions.c
@@ -305,8 +305,14 @@ gs_plugin_setup (GsPlugin *plugin, GCancellable *cancellable, GError **error)
        /* get the GNOME Shell version */
        version = g_dbus_proxy_get_cached_property (priv->proxy,
                                                    "ShellVersion");
-       if (version != NULL)
-               priv->shell_version = g_variant_dup_string (version, NULL);
+       if (version == NULL) {
+               g_set_error_literal (error,
+                                    GS_PLUGIN_ERROR,
+                                    GS_PLUGIN_ERROR_NOT_SUPPORTED,
+                                    "unable to get shell version");
+               return FALSE;
+       }
+       priv->shell_version = g_variant_dup_string (version, NULL);
        return TRUE;
 }
 


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