[gnome-software/1937-crash-when-showing-offline-update-errors] gs-application: Make most of the GAction-s activatable only after GsShell is setup



commit db0b7d135f296a64f6b20ae78c6ec9632ef0a8cb
Author: Milan Crha <mcrha redhat com>
Date:   Fri Oct 7 08:13:00 2022 +0200

    gs-application: Make most of the GAction-s activatable only after GsShell is setup
    
    Most of the app actions expect the GsShell to be fully setup, which means also
    the respective window pages are setup. Calling the app actions before the initialization
    of the respective parts leads to crashes.
    
    Closes https://gitlab.gnome.org/GNOME/gnome-software/-/issues/1937

 src/gs-application.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)
---
diff --git a/src/gs-application.c b/src/gs-application.c
index 0e5a1a49c..961c40019 100644
--- a/src/gs-application.c
+++ b/src/gs-application.c
@@ -899,17 +899,17 @@ verbose_activated (GSimpleAction *action,
 static GActionEntry actions[] = {
        { "about", about_activated, NULL, NULL, NULL },
        { "quit", quit_activated, NULL, NULL, NULL },
+       { "verbose", verbose_activated, NULL, NULL, NULL },
+       { "nop", NULL, NULL, NULL }
+};
+
+static GActionEntry actions_after_loading[] = {
        { "reboot-and-install", reboot_and_install, NULL, NULL, NULL },
        { "reboot", reboot_activated, NULL, NULL, NULL },
        { "shutdown", shutdown_activated, NULL, NULL, NULL },
        { "launch", launch_activated, "(ss)", NULL, NULL },
        { "show-offline-update-error", show_offline_updates_error, NULL, NULL, NULL },
        { "autoupdate", autoupdate_activated, NULL, NULL, NULL },
-       { "verbose", verbose_activated, NULL, NULL, NULL },
-       { "nop", NULL, NULL, NULL }
-};
-
-static GActionEntry actions_after_loading[] = {
        { "sources", sources_activated, NULL, NULL, NULL },
        { "prefs", prefs_activated, NULL, NULL, NULL },
        { "set-mode", set_mode_activated, "s", NULL, NULL },
@@ -1101,10 +1101,11 @@ startup_cb (GObject      *source_object,
        /* show the priority of each plugin */
        gs_plugin_loader_dump_state (plugin_loader);
 
+       app->update_monitor = gs_update_monitor_new (app, app->plugin_loader);
+
        /* Setup the shell only after the plugin loader finished its setup,
           thus all plugins are loaded and ready for the jobs. */
        gs_shell_setup (app->shell, app->plugin_loader, app->cancellable);
-       app->update_monitor = gs_update_monitor_new (app, app->plugin_loader);
 }
 
 static void


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