[glib] Deal with startup notify id being NULL
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] Deal with startup notify id being NULL
- Date: Sat, 12 Apr 2014 02:00:21 +0000 (UTC)
commit 94e5dafbc9ae823590aa3a3f3989b8f5978f1a9d
Author: Matthias Clasen <mclasen redhat com>
Date: Fri Apr 11 15:46:38 2014 -0700
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
gio/gdesktopappinfo.c | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/gio/gdesktopappinfo.c b/gio/gdesktopappinfo.c
index 0582b52..7cf3cc0 100644
--- a/gio/gdesktopappinfo.c
+++ b/gio/gdesktopappinfo.c
@@ -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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]