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



markus korn wrote:
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.

It works with Vala 0.7.9.

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?

Yes, it's possible. Your code is a good example. :)

 * 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

You should try the Ubuntu Vala PPA:
https://launchpad.net/~vala-team/+archive/ppa
(Don't forget to uninstall the old 'valac' package of the main repository)

$ 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):

Try

      def TestInt(self, i):

at this point (because Vala does D-Bus method name transformation:
"test_int" -> "TestInt") and compile the client with Vala 0.7.9. Then it
should work.


Best regards,

Frederik



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