[gnome-session/wip/fix-autostart-critical] autostart-app: don't try to add child watch to dbus activated services



commit 3047871ea06e7def812c0621a9b5565c67f86b9f
Author: Ray Strode <rstrode redhat com>
Date:   Wed Jun 5 11:02:45 2019 -0400

    autostart-app: don't try to add child watch to dbus activated services
    
    If a service is dbus activated, then gnome-session isn't starting it
    directly and it makes no sense to try to create a child watch on it.
    
    This commit ensures, child watches are only set up on apps that are
    started directly by gnome-session, which avoids generating a critical
    message in the log for each dbus activated app.
    
    https://gitlab.gnome.org/GNOME/gnome-session/issues/14

 gnome-session/gsm-autostart-app.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/gnome-session/gsm-autostart-app.c b/gnome-session/gsm-autostart-app.c
index 2332b039..aa460f5e 100644
--- a/gnome-session/gsm-autostart-app.c
+++ b/gnome-session/gsm-autostart-app.c
@@ -1032,10 +1032,12 @@ autostart_app_start_spawn (GsmAutostartApp *app,
         g_signal_handler_disconnect (ctx, handler);
 
         if (success) {
-                g_debug ("GsmAutostartApp: started pid:%d", app->priv->pid);
-                app->priv->child_watch_id = g_child_watch_add (app->priv->pid,
-                                                               (GChildWatchFunc)app_exited,
-                                                               app);
+                if (app->priv->pid > 0) {
+                        g_debug ("GsmAutostartApp: started pid:%d", app->priv->pid);
+                        app->priv->child_watch_id = g_child_watch_add (app->priv->pid,
+                                                                       (GChildWatchFunc)app_exited,
+                                                                       app);
+                }
         } else {
                 g_set_error (error,
                              GSM_APP_ERROR,


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