Commit 94e5dafb authored by Matthias Clasen's avatar Matthias Clasen

Deal with startup notify id being NULL

The app launch context may just not support startup notification,
in which case, g_app_launch_context_get_startup_notify_id() will
return NULL.

Failure to take this into account leads to criticals like this:
gnome-session[8489]: GLib-CRITICAL: g_variant_new_take_string: assertion 'string != NULL' failed
gnome-session[8489]: GLib-CRITICAL: g_variant_new_variant: assertion 'value != NULL' failed
gnome-session[8489]: GLib-CRITICAL: g_variant_get_type: assertion 'value != NULL' failed
gnome-session[8489]: GLib-CRITICAL: g_variant_type_is_subtype_of: assertion 'g_variant_type_check (type)' failed

https://bugzilla.gnome.org/show_bug.cgi?id=728066
parent 6c395244
......@@ -2182,7 +2182,11 @@ g_desktop_app_info_launch_uris_with_spawn (GDesktopAppInfo *info,
sn_id = g_app_launch_context_get_startup_notify_id (launch_context,
G_APP_INFO (info),
launched_files);
envp = g_environ_setenv (envp, "DESKTOP_STARTUP_ID", sn_id, TRUE);
if (sn_id)
{
envp = g_environ_setenv (envp, "DESKTOP_STARTUP_ID", sn_id, TRUE);
g_free (sn_id);
}
}
g_list_free_full (launched_files, g_object_unref);
......@@ -2289,7 +2293,8 @@ g_desktop_app_info_make_platform_data (GDesktopAppInfo *info,
gchar *sn_id;
sn_id = g_app_launch_context_get_startup_notify_id (launch_context, G_APP_INFO (info), launched_files);
g_variant_builder_add (&builder, "{sv}", "desktop-startup-id", g_variant_new_take_string (sn_id));
if (sn_id)
g_variant_builder_add (&builder, "{sv}", "desktop-startup-id", g_variant_new_take_string (sn_id));
}
g_list_free_full (launched_files, g_object_unref);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment