mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-04-26 09:06:52 +02:00
gdesktopappinfo: Don't crash if we don't have a desktop filename
If code creates a GDesktopAppInfo via g_desktop_app_info_new_from_keyfile(), we'd try to send a NULL pointer down into GVariant. Since in this case we don't have a filename, just send the empty string. In the future we should either: 1) Change panel to use g_desktop_app_info_new_from_filename(), and take the hit of parsing the file twice. 2) Add a g_key_file_get_origin_filename() 3) Add g_desktop_app_info_new_from_keyfile_and_name() https://bugzilla.gnome.org/show_bug.cgi?id=638838
This commit is contained in:
parent
26b65a3abd
commit
e738a8dd8c
@ -932,7 +932,7 @@ child_setup (gpointer user_data)
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
notify_desktop_launch (GDBusConnection *session_bus,
|
notify_desktop_launch (GDBusConnection *session_bus,
|
||||||
const char *desktop_file, /* filename */
|
GDesktopAppInfo *info,
|
||||||
long pid,
|
long pid,
|
||||||
const char *display,
|
const char *display,
|
||||||
const char *sn_id,
|
const char *sn_id,
|
||||||
@ -942,6 +942,7 @@ notify_desktop_launch (GDBusConnection *session_bus,
|
|||||||
GVariantBuilder uri_variant;
|
GVariantBuilder uri_variant;
|
||||||
GVariantBuilder extras_variant;
|
GVariantBuilder extras_variant;
|
||||||
GList *iter;
|
GList *iter;
|
||||||
|
const char *desktop_file_id;
|
||||||
|
|
||||||
if (session_bus == NULL)
|
if (session_bus == NULL)
|
||||||
return;
|
return;
|
||||||
@ -957,11 +958,18 @@ notify_desktop_launch (GDBusConnection *session_bus,
|
|||||||
g_variant_new ("s",
|
g_variant_new ("s",
|
||||||
sn_id));
|
sn_id));
|
||||||
|
|
||||||
|
if (info->filename)
|
||||||
|
desktop_file_id = info->filename;
|
||||||
|
else if (info->desktop_id)
|
||||||
|
desktop_file_id = info->desktop_id;
|
||||||
|
else
|
||||||
|
desktop_file_id = "";
|
||||||
|
|
||||||
msg = g_dbus_message_new_signal ("/org/gtk/gio/DesktopAppInfo",
|
msg = g_dbus_message_new_signal ("/org/gtk/gio/DesktopAppInfo",
|
||||||
"org.gtk.gio.DesktopAppInfo",
|
"org.gtk.gio.DesktopAppInfo",
|
||||||
"Launched");
|
"Launched");
|
||||||
g_dbus_message_set_body (msg, g_variant_new ("(@aysxasa{sv})",
|
g_dbus_message_set_body (msg, g_variant_new ("(@aysxasa{sv})",
|
||||||
g_variant_new_bytestring (desktop_file),
|
g_variant_new_bytestring (desktop_file_id),
|
||||||
display ? display : "",
|
display ? display : "",
|
||||||
(gint64)pid,
|
(gint64)pid,
|
||||||
&uri_variant,
|
&uri_variant,
|
||||||
@ -1069,7 +1077,7 @@ _g_desktop_app_info_launch_uris_internal (GAppInfo *appinfo,
|
|||||||
pid_callback (info, pid, pid_callback_data);
|
pid_callback (info, pid, pid_callback_data);
|
||||||
|
|
||||||
notify_desktop_launch (session_bus,
|
notify_desktop_launch (session_bus,
|
||||||
info->filename,
|
info,
|
||||||
pid,
|
pid,
|
||||||
data.display,
|
data.display,
|
||||||
data.sn_id,
|
data.sn_id,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user