[python?] DBus + gtk + thread = problems

Simon McVittie simon.mcvittie at collabora.co.uk
Wed Mar 19 05:54:04 PDT 2008


On Wed, 19 Mar 2008 at 13:08:57 +0100, René 'Necoro' Neumann wrote:
> I yesterday discovered a bug in dbus (or dbus-python) when using dbus
> inside of a (py)gtk application: As an example, I create a window with a
> button. When clicking the button, a new thread is started which runs a
> dbus statement. (see attached example)

You need to tell dbus-glib to initialize libdbus' thread locks, which
you can do via:

from dbus.mainloop.glib import threads_init
threads_init()

Otherwise, libdbus will have no thread locking, and will concurrently
modify data in multiple threads. Don't let it do that.

    Simon


More information about the dbus mailing list