dbus call into a program -> hangs

Kacper Wysocki kacperw at online.no
Fri Nov 17 13:54:46 PST 2006


Hi all,
so I have an app that I'd like to put some dbus code into, to detect
if there's already a running instance, and if so, pass the arguments
to that instance. Let's not beat around the bush here, I'll tell you
this application is the Gnome Meld visual diff program, which is, as
it happens, implemented in python.

Upon Meld startup, before meld goes into its mainloop, I register the
dbus service methods and then pass control back to the application.
Trouble is, whenever I try to invoke any of these methods from another
application both the called and the calling application freeze - until
the process that registered the dbus service methods is cancelled.

If I run the registration of the object and methods in a standalone
app that loops with the gobject mainloop (no meld), method invokation
over dbus by other apps works as expected.

Is there something basic that I'm missing here about dbus?

Meld uses the gnomeglade.GnomeApp.main() loop, and I'm wondering
whether that's where the problem lies, with meld not processing the
incoming dbus requests or whatnot. If that's the case, could someone
kindly give me some pointers as to how to deal with this?

Some cut down code on what I'm doing:
# In meld main func
export_dbus_iface()
app = MeldApp()
app.main()

Where export_dbus_iface() does exactly what "Exporting Methods Over
The Bus" in the python dbus tutorial describes, except it doesn't call
gobject.MainLoop().run().

#My client app:
import dbus
bus = dbus.SessionBus()
proxy = bus.get_object('org.gnome.meld', '/org/gnome/meld')
iface = dbus.Interface(proxy, 'org.gnome.meld')
print iface.call()

Thanks,
 -Kacper


More information about the dbus mailing list