[gnome-shell/gnome-41] shell: Do not create a systemd scope when using D-Bus app launching



commit 03dc129f566a032187661b2ef26a13418c920d00
Author: msizanoen1 <msizanoen qtmlabs xyz>
Date:   Thu May 26 13:15:06 2022 +0700

    shell: Do not create a systemd scope when using D-Bus app launching
    
    Applications launched using D-Bus activation will have a returned PID of
    0, which systemd interprets as moving the requesting process to a new
    scope, causing GNOME Shell to be moved to another scope. Fix this by not
    creating a systemd scope when PID is 0.
    
    Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2305>
    (cherry picked from commit afcd58e3bafe7ac817f883f40e87993ebfe482a7)

 src/shell-global.c | 5 +++++
 1 file changed, 5 insertions(+)
---
diff --git a/src/shell-global.c b/src/shell-global.c
index e8705f5b08..26ed229103 100644
--- a/src/shell-global.c
+++ b/src/shell-global.c
@@ -1458,6 +1458,11 @@ shell_global_app_launched_cb (GAppLaunchContext *context,
   if (!g_variant_lookup (platform_data, "pid", "i", &pid))
     return;
 
+  /* If pid == 0 the application was launched through D-Bus
+   * activation, therefore it's already in its own unit */
+  if (pid == 0)
+    return;
+
   app_name = g_app_info_get_id (info);
   if (app_name == NULL)
     app_name = g_app_info_get_executable (info);


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