[Xfce-bugs] [Bug 15770] New: Proper determination of D-Bus name ownership

bugzilla-daemon at xfce.org bugzilla-daemon at xfce.org
Thu Aug 1 01:10:24 CEST 2019


https://bugzilla.xfce.org/show_bug.cgi?id=15770

            Bug ID: 15770
           Summary: Proper determination of D-Bus name ownership
    Classification: Xfce Core
           Product: Xfce4-appfinder
           Version: Unspecified
          Hardware: Other
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: Medium
         Component: General
          Assignee: xfce-bugs at xfce.org
          Reporter: mrugiero at gmail.com
  Target Milestone: Xfce 4.14

This is against git master from a few weeks ago.
If it doesn't apply I'll rebase it, but right now I'm copying directly from a
different report as is.
The explanation is also more or less copied.

Take the following situation.
1. For some reason we have the well-known name owned by someone, but this
someone doesn't answer connections.
2. We have timeouts, making startup slow.
3. After the timeouts, we try to take ownership of the name, which is probably
reasonable.

The way appfinder works now, the following happens:
1. We make a mistake. We use g_dbus_own_name and take its return value as
meaningful proof that we're now the owner, when it always returns non-zero and
is asynchronous. We have no idea if we own the name until after we run
gtk_main_loop.
2. We think we own the name, and thus are the server, so we must not die on
close.

This happened in the context of issue #15623.

The attached patch takes care of it by using an explicit message to
synchronously ask for ownership and detect whether it was granted.
This way, if a server is running but doesn't answer, the new process realizes
it isn't the server itself, so it must die when the window is closed, thus
avoiding lingering processes.

This is the original patch, as attached to #15623:
https://bugzilla.xfce.org/attachment.cgi?id=8733

I'm not sure if downloading and reattaching is mandatory, but of course will do
if asked so.
It just seemed more practical this way.

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the Xfce-bugs mailing list