Comment 7 for bug 1691649

Revision history for this message
James Henstridge (jamesh) wrote :

So judging by the logs in some of the related error reports, we get the following log messages:

   xdg-desktop-por[3113]: Failed to create file chooser proxy: Error calling StartServiceByName for org.freedesktop.impl.portal.desktop.gtk: Timeout was reached
   xdg-desktop-por[3113]: g_dbus_interface_skeleton_set_flags: assertion 'G_IS_DBUS_INTERFACE_SKELETON (interface_)' failed
   xdg-desktop-por[3113]: invalid (NULL) pointer instance
   xdg-desktop-por[3113]: g_signal_connect_data: assertion 'G_TYPE_CHECK_INSTANCE (instance)' failed
   xdg-desktop-por[3113]: g_dbus_interface_skeleton_export: assertion 'G_IS_DBUS_INTERFACE_SKELETON (interface_)' failed

This centres around the following code, which is the first portal whose export depends on the presence of a UI implementation:

https://github.com/flatpak/xdg-desktop-portal/blob/1.0.2/src/xdg-desktop-portal.c#L382-L385

  implementation = find_portal_implementation ("org.freedesktop.impl.portal.FileChooser");
  if (implementation != NULL)
    export_portal_implementation (connection,
        file_chooser_create (connection, implementation->dbus_name));

The first line looks up a backend implementation of the FileChooser portal based on the implementations registered in /usr/share/xdg-desktop-portal/portals, and picks xdg-desktop-portal-gtk.

The file_chooser_create method then tries to activate the selected D-Bus name:

https://github.com/flatpak/xdg-desktop-portal/blob/1.0.2/src/file-chooser.c#L578-L589

This corresponds to the first log message, and indicates that starting xdg-desktop-portal-gtk timed out. It returns NULL, and export_portal_implementation() contains no checks for NULL as a second argument leading to the other messages. It ends with a g_return_val_if_fail() check causing g_dbus_interface_skeleton_export() to return FALSE without setting an error. We then get a segfault trying to dereference a NULL GError pointer.

So there's two issues to address:

 1. xdg-desktop-portal-gtk startup is timing out in some instances.
 2. xdg-desktop-portal is not handling this timeout error correctly.

I'll look at addressing (2) since it is the immediate cause of the crash reports, but portals are of limited use if they can't rely on any of the GUI helpers for things like file choosers.