[Vala] Segmentation fault when sending an integer over DBus to a service written in Python



Hi,
let's say I've a DBus service written in python, and I would like to
write a client using vala to invoke a remote method with an integer
argument (see sample code below). For me the client segfaults whenever
I try to run it.
So here are my questions:
 * is such scenario even possible (using a client written in vala to
access a service written in python)? does anybody have sample code for
this?
 * did I do something wrong on the vala side which might explain the
issue (I just discovered vala today, so there is a good chance for
it)?

$ valac --version  # (ubuntu karmic)
Vala 0.7.6


$ python pyserver.py   # to run the service
$ valac --pkg dbus-glib-1 client.vala    # to compile the client
$ ./client   # to run the client


=========
pyserver.py
=========

import gobject

import dbus
import dbus.service
import dbus.mainloop.glib


class SomeObject(dbus.service.Object):

    @dbus.service.method("org.example.Test", in_signature="i",
out_signature="i")
    def test_int(self, i):
        print i
        return 1000

if __name__ == '__main__':
    dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)

    session_bus = dbus.SessionBus()
    name = dbus.service.BusName("org.example.Test", session_bus)
    object = SomeObject(session_bus, '/org/example/test')

    mainloop = gobject.MainLoop()
    mainloop.run()

========
client.vala
========

[DBus (name = "org.example.Test")]
interface Test : Object {
    public abstract int test_int (int32 x) throws DBus.Error;
}

void main () {
    var conn = DBus.Bus.get (DBus.BusType.SESSION);
    var test = (Test) conn.get_object ("org.example.Test", "/org/example/test");
    int32 x = 1;
    test.test_int(x);
}


Thanks
Markus



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]