GdkAppLaunchContext: Use the display name for X11

Using a NULL GAppInfo with g_app_launch_context_get_display() will
generate a critical warning in gio.

Use the display name instead as we don't have any valid GAppInfo to pass
to g_app_launch_context_get_display().

bugzilla: https://bugzilla.gnome.org/show_bug.cgi?id=756439
This commit is contained in:
Olivier Fourdan 2015-10-12 16:11:11 +02:00
parent ab001d01c8
commit 4398e12469

View File

@ -463,14 +463,13 @@ GdkAppLaunchContext *
_gdk_x11_display_get_app_launch_context (GdkDisplay *display) _gdk_x11_display_get_app_launch_context (GdkDisplay *display)
{ {
GdkAppLaunchContext *ctx; GdkAppLaunchContext *ctx;
static gchar *display_name; const gchar *display_name;
ctx = g_object_new (GDK_TYPE_X11_APP_LAUNCH_CONTEXT, ctx = g_object_new (GDK_TYPE_X11_APP_LAUNCH_CONTEXT,
"display", display, "display", display,
NULL); NULL);
display_name = g_app_launch_context_get_display (G_APP_LAUNCH_CONTEXT (ctx), display_name = gdk_display_get_name (display);
NULL, NULL);
if (display_name) if (display_name)
g_app_launch_context_setenv (G_APP_LAUNCH_CONTEXT (ctx), g_app_launch_context_setenv (G_APP_LAUNCH_CONTEXT (ctx),
"DISPLAY", display_name); "DISPLAY", display_name);