[glib/glib-2-32] GAppInfo: overwrite the DISPLAY only if it is set in the launch context



commit 9926b9315c3f74a9b0b54fb29cd6495dd363fd54
Author: Debarshi Ray <debarshir gnome org>
Date:   Mon Apr 16 23:00:01 2012 +0200

    GAppInfo: overwrite the DISPLAY only if it is set in the launch context
    
    If the launch context is a GAppLaunchContext, and not a
    GdkAppLaunchContext, then g_app_launch_context_get_display will return
    NULL because the get_display virtual method is undefined. The DISPLAY
    might still be inherited from the parent process, in which case
    overwriting it with NULL breaks the launch.
    
    This is a regression introduced in:
    de834bed306565c0652050665eafff4dfcdf0d8b
    
    Fixes: https://bugzilla.gnome.org/672786

 gio/gdesktopappinfo.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/gio/gdesktopappinfo.c b/gio/gdesktopappinfo.c
index 4afa6dc..974a43f 100644
--- a/gio/gdesktopappinfo.c
+++ b/gio/gdesktopappinfo.c
@@ -1306,7 +1306,8 @@ _g_desktop_app_info_launch_uris_internal (GAppInfo                   *appinfo,
           display = g_app_launch_context_get_display (launch_context,
                                                       appinfo,
                                                       launched_files);
-          envp = g_environ_setenv (envp, "DISPLAY", display, TRUE);
+          if (display)
+            envp = g_environ_setenv (envp, "DISPLAY", display, TRUE);
 
           if (info->startup_notify)
             {



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