From: Junghoon Park Date: Fri, 3 Aug 2018 02:00:30 +0000 (+0900) Subject: Add initializer for callback handle X-Git-Tag: submit/tizen/20180803.024210~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=be128ed9d18db8e8a86afd913e20e2fadcee342a;p=platform%2Fcore%2Fappfw%2Ftidl.git Add initializer for callback handle Change-Id: I869f77ffc89a255ecb93199c4f370610ed4a7753 Signed-off-by: Junghoon Park --- diff --git a/idlc/c_gen/c_stub_body_gen.cc b/idlc/c_gen/c_stub_body_gen.cc index d340aef..565d7ea 100644 --- a/idlc/c_gen/c_stub_body_gen.cc +++ b/idlc/c_gen/c_stub_body_gen.cc @@ -181,7 +181,7 @@ std::string CStubBodyGen::GetMethodString(const Interface& inf, if (IsDelegateType(inf, i->GetParameterType().GetBaseType())) { str += "rpc_port_" + GetInterfaceIdWithNamespace(inf) + "_" + i->GetParameterType().GetBaseType().ToString() + "_h " + - i->GetID() + ";" + NLine(1); + i->GetID() + " = NULL;" + NLine(1); } else { str += GetReturnTypeString(i->GetParameterType().GetBaseType()) + i->GetID() + ";" + NLine(1); @@ -202,6 +202,10 @@ std::string CStubBodyGen::GetMethodString(const Interface& inf, str += "rpc_port_" + GetInterfaceIdWithNamespace(inf) + "_" + i->GetParameterType().GetBaseType().ToString() + "_create(&" + i->GetID() + ");" + NLine(1); + str += "\nif (!" + i->GetID() + ") {\n"; + str += " _E(\"Failed to create handle\");\n"; + str += " return -1;\n"; + str += "}\n\n"; str += GenTemplateString(port_setter, [&]()->std::string { return GetInterfaceIdWithNamespace(inf) + "_" + diff --git a/idlc/c_gen/c_stub_body_gen_cb.h b/idlc/c_gen/c_stub_body_gen_cb.h index a9bce78..db744e2 100644 --- a/idlc/c_gen/c_stub_body_gen_cb.h +++ b/idlc/c_gen/c_stub_body_gen_cb.h @@ -26,8 +26,10 @@ static int __$$_method_$$(rpc_port_h port, rpc_port_parcel_h parcel, void *data) int r; r = rpc_port_stub_get_port(__$$_stub, RPC_PORT_PORT_CALLBACK, context->instance, &callback_port); - if (r != 0) + if (r != 0) { _E("Failed to get callback port"); + return -1; + } $$ return 0;