I get segfaults when calling the dbus method inside the stream. This is my scenario: I have a Service1 program that provides a test method. The second Service2 program provides an expansion method. Since this method does some serious numerical calculations, I pass some parameters from exposure to the current stream reader. This thread, in turn, calls the method of the Service1 method when it finishes its work. I get segfaults in the last dbus call.
Code:
# Service1.py class Service1(Object): def __init__(self, bus): name = BusName('com.example.Service1', bus) path = '/' super(Service1, self).__init__(name, path) @method(dbus_interface='com.example.Service1', in_signature='s', out_signature='s') def test(self, test): print 'test being called' return test dbus_loop = DBusGMainLoop() dsession = SessionBus(mainloop=dbus_loop) loop = gobject.MainLoop() gobject.threads_init() im = Service1(dsession) loop.run()
To test, run Service1.py, Service2.py and later this snippet:
dbus_loop = DBusGMainLoop() session = SessionBus(mainloop=dbus_loop) proxy = session.get_object('com.example.Service2', '/') test_i = dbus.Interface(proxy, dbus_interface='com.example.Service2') test_i.expose()
Service2.py should work after running this code several times. But why?
source share