6 [DBus (name = "org.example.Test")]
7 interface Test : Object {
8 public abstract async string test_array_lifetime (string[] items) throws IOError;
14 main_loop = new MainLoop ();
20 Test test = yield Bus.get_proxy (BusType.SESSION, "org.example.Test", "/org/example/test");
22 var result = yield test.test_array_lifetime (new string[] { "Badger", "Snake", "Mushroom" });
23 assert (result == "BadgerSnakeMushroom");
30 [DBus (name = "org.example.Test")]
32 public async string test_array_lifetime (string[] items) throws IOError {
34 test_array_lifetime.callback ();
39 var result = new StringBuilder ();
40 foreach (var item in items) {
44 assert (result.str == "BadgerSnakeMushroom");
51 void on_client_exit (Pid pid, int status) {
57 var conn = Bus.get_sync (BusType.SESSION);
58 conn.register_object ("/org/example/test", new Test ());
60 var request_result = conn.call_sync ("org.freedesktop.DBus", "/org/freedesktop/DBus", "org.freedesktop.DBus", "RequestName",
61 new Variant ("(su)", "org.example.Test", 0x4), null, 0, -1);
62 assert ((uint) request_result.get_child_value (0) == 1);
65 Process.spawn_async (null, { "test", "/dbus/bug783002/client" }, null, SpawnFlags.DO_NOT_REAP_CHILD, null, out client_pid);
66 ChildWatch.add (client_pid, on_client_exit);
68 main_loop = new MainLoop ();