Hi,
Am Donnerstag, den 16.09.2010, 08:56 +0200 schrieb Patrick Ohly:
On Wed, 2010-09-15 at 22:08 +0100, Frederik Elwert wrote:
> the new DBus API extensions work like charm! I now make use of them in
> Genesis when available.
Good :-)
> I just ran into one issue: When calling syncevolution from the
> commandline, the session methods are not available.
>
> I want to check for session flags, since Genesis should not show sync
> result reports for config sessions. And if I understood correctly, the
> commandline sets a "no-sync" flag in these cases. But if I run
>
> syncevolution --print-sessions scheduleworld
>
> from the commandline, I get an exception:
>
> DBusException: org.freedesktop.DBus.Error.UnknownMethod: Method
> "GetFlags" with signature "" on interface
> "org.syncevolution.Session" doesn't exist
Do you get this exception inside Genesis?
Yes, it is inside the StatusChanged handler.
Is it possible that the command line session has already terminated
at
the time when Genesis tries to make that call? "dbus-monitor" will show
that.
That seems to be the problem. There is a race condition between the
session terminating and the StatusChanged callback being executed. I
tried it some times with dbus-monitor running, and sometimes it ran
through, sometimes it threw the exception at the first method call
(GetFlags), sometimes at the second one (GetConfigName).
I don’t really now how to deal with this. This affects all sessions
created by other clients (sync-ui, commandline). When the session sends
the StatusChanged signal "done", I want to get two things: the flags (if
"no-sync", don’t need to report anything) and the config name (to
include it in the sync report). But if the session already terminated at
that point, I cannot request this information.
From Genesis’ side, I could catch the exceptions and ignore them
(i.e.,
act as I did before the new methods were introduced). Should work, but
maybe is not really pretty. Another idea would be to allow other clients
to Attach() to sessions to prevent them from terminating before they are
dealt with. But I don’t know if this is really reasonable.
Maybe I am just overlooking a more obvious solution, so any hints
welcome. :-)
Regards,
Frederik