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:
de834bed30

Fixes: https://bugzilla.gnome.org/672786
This commit is contained in:
Debarshi Ray 2012-04-16 23:00:01 +02:00
parent 6219767f61
commit 3f816dc5d1

View File

@ -1309,7 +1309,8 @@ _g_desktop_app_info_launch_uris_internal (GAppInfo *appinfo,
display = g_app_launch_context_get_display (launch_context, display = g_app_launch_context_get_display (launch_context,
appinfo, appinfo,
launched_files); launched_files);
envp = g_environ_setenv (envp, "DISPLAY", display, TRUE); if (display)
envp = g_environ_setenv (envp, "DISPLAY", display, TRUE);
if (info->startup_notify) if (info->startup_notify)
{ {