diff options
author | Junghoon Park <jh9216.park@samsung.com> | 2018-06-28 19:28:56 +0900 |
---|---|---|
committer | Junghoon Park <jh9216.park@samsung.com> | 2018-06-28 19:30:56 +0900 |
commit | 58b50871a069ac9ff8c58766e58d0652a707af2b (patch) | |
tree | d7c4a407585402a1afb7422eb09980b11944f5d2 | |
parent | 31419f6611755633d6bc23a9f0025711cfdbad18 (diff) | |
download | tidl-58b50871a069ac9ff8c58766e58d0652a707af2b.tar.gz tidl-58b50871a069ac9ff8c58766e58d0652a707af2b.tar.bz2 tidl-58b50871a069ac9ff8c58766e58d0652a707af2b.zip |
Add exception handler in stub code
Change-Id: I7d04e8583b31cbe2787507b1d33ba724fb628d6b
Signed-off-by: Junghoon Park <jh9216.park@samsung.com>
-rw-r--r-- | idlc/cs_gen/cs_cb_rpc_port.h | 12 | ||||
-rw-r--r-- | idlc/cs_gen/cs_stub_gen_cb.h | 12 |
2 files changed, 20 insertions, 4 deletions
diff --git a/idlc/cs_gen/cs_cb_rpc_port.h b/idlc/cs_gen/cs_cb_rpc_port.h index a2b52d1..97f6911 100644 --- a/idlc/cs_gen/cs_cb_rpc_port.h +++ b/idlc/cs_gen/cs_cb_rpc_port.h @@ -46,17 +46,23 @@ namespace Tizen.Applications.RPCPort public Parcel() { - Interop.LibRPCPort.Parcel.Create(out _handle); + var r = Interop.LibRPCPort.Parcel.Create(out _handle); + if (r != Interop.LibRPCPort.ErrorCode.None) + throw new InvalidIOException(); } public Parcel(Port port) { - Interop.LibRPCPort.Parcel.CreateFromPort(out _handle, port.Handle); + var r = Interop.LibRPCPort.Parcel.CreateFromPort(out _handle, port.Handle); + if (r != Interop.LibRPCPort.ErrorCode.None) + throw new InvalidIOException(); } public void Send(Port p) { - Interop.LibRPCPort.Parcel.Send(_handle, p.Handle); + var r = Interop.LibRPCPort.Parcel.Send(_handle, p.Handle); + if (r != Interop.LibRPCPort.ErrorCode.None) + throw new InvalidIOException(); } public void WriteByte(byte b) diff --git a/idlc/cs_gen/cs_stub_gen_cb.h b/idlc/cs_gen/cs_stub_gen_cb.h index 7a7a99c..3be382a 100644 --- a/idlc/cs_gen/cs_stub_gen_cb.h +++ b/idlc/cs_gen/cs_stub_gen_cb.h @@ -61,7 +61,9 @@ const char CB_ON_RECEIVED_EVENT_FRONT[] = R"__cs_cb( protected override bool OnReceivedEvent(string sender, string instance, Port port) { - using (var p = new Parcel(port)) + var p = new Parcel(port); + + try { ServiceBase b = null; @@ -96,6 +98,14 @@ R"__cs_cb( return true; } + catch (InvalidIOException) + { + return false; + } + finally + { + p.Dispose(); + } } )__cs_cb"; |