[vala/wip/transform: 128/132] GBus: Handle fd_list being null
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/wip/transform: 128/132] GBus: Handle fd_list being null
- Date: Mon, 16 Apr 2018 15:13:35 +0000 (UTC)
commit 562afa9ff8aad7a33347b1bbfd63020eb714ef5d
Author: Rico Tzschichholz <ricotz ubuntu com>
Date: Sun Mar 19 23:14:10 2017 +0100
GBus: Handle fd_list being null
codegen/valagdbusclienttransformer.vala | 1 +
codegen/valagdbusservertransformer.vala | 4 ++++
2 files changed, 5 insertions(+), 0 deletions(-)
---
diff --git a/codegen/valagdbusclienttransformer.vala b/codegen/valagdbusclienttransformer.vala
index 2f006cf..81dec84 100644
--- a/codegen/valagdbusclienttransformer.vala
+++ b/codegen/valagdbusclienttransformer.vala
@@ -52,6 +52,7 @@ public class Vala.GDBusClientTransformer : GVariantTransformer {
fd_index = b.add_temp_declaration (null, expression ("0"));
statements (@"$fd_list = $message.get_unix_fd_list ();");
}
+ statements (@"if ($fd_list == null) { throw new GLib.IOError.FAILED (\"FD List is
NULL\"); }");
statements (@"$iter.next (\"h\", out $fd_index);");
if (type_name == "GLib.UnixInputStream") {
return expression (@"new GLib.UnixInputStream ($fd_list.get ($fd_index),
true)");
diff --git a/codegen/valagdbusservertransformer.vala b/codegen/valagdbusservertransformer.vala
index ba03293..82655d1 100644
--- a/codegen/valagdbusservertransformer.vala
+++ b/codegen/valagdbusservertransformer.vala
@@ -85,7 +85,11 @@ public class Vala.GDBusServerTransformer : GDBusClientTransformer {
if (param.direction == ParameterDirection.IN) {
var arg = b.add_temp_declaration (copy_type (param.variable_type, true));
+ b.open_try ();
b.add_assignment (expression (arg), read_dbus_value (param.variable_type,
iter, "invocation.get_message ()", ref fd_list, ref fd_index));
+ b.add_catch_all ("_invocation_gerror_");
+ statements ("invocation.return_gerror (_invocation_gerror_); return;");
+ b.close ();
call.add_argument (expression (arg));
} else if (param.direction == ParameterDirection.OUT) {
if (m.coroutine) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]