diff options
author | Lauro Moura <lauromoura@expertisesolutions.com.br> | 2019-12-10 14:39:42 -0300 |
---|---|---|
committer | Lauro Moura <lauromoura@expertisesolutions.com.br> | 2019-12-11 00:20:44 -0300 |
commit | 9472ec86ecc6f43f35591f4a5817bbd9b5a1f3b3 (patch) | |
tree | ef48848590f130c93a6ef13154d049bebdb0bc08 | |
parent | c1293edbd2a8bc85c7bc168c05b333c3b605d4c1 (diff) | |
download | efl-9472ec86ecc6f43f35591f4a5817bbd9b5a1f3b3.tar.gz |
csharp: Disable annotations for out non-own strings
They will be handled manually to avoid leaks, as the control would
return to C before the custom marshaller could release them.
-rw-r--r-- | src/bin/eolian_mono/eolian/mono/marshall_annotation.hh | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/bin/eolian_mono/eolian/mono/marshall_annotation.hh b/src/bin/eolian_mono/eolian/mono/marshall_annotation.hh index 3cd9f6d267..4c0e77ff61 100644 --- a/src/bin/eolian_mono/eolian/mono/marshall_annotation.hh +++ b/src/bin/eolian_mono/eolian/mono/marshall_annotation.hh @@ -98,13 +98,17 @@ struct marshall_annotation_visitor_generate return "MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringOutPassOwnershipMarshaler))"; }}, {"string", false, [] { - return "MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringOutKeepOwnershipMarshaler))"; + // Non-owned returned strings are marshalled manually due to lifetime issues + return ""; + // return "MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringOutKeepOwnershipMarshaler))"; }}, {"mstring", true, [] { return "MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringOutPassOwnershipMarshaler))"; }}, {"mstring", false, [] { - return "MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringOutKeepOwnershipMarshaler))"; + // Non-owned returned strings are marshalled manually due to lifetime issues + return ""; + // return "MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringOutKeepOwnershipMarshaler))"; }}, {"stringshare", true, [] { return "MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef=typeof(Efl.Eo.StringsharePassOwnershipMarshaler))"; @@ -138,6 +142,9 @@ struct marshall_annotation_visitor_generate auto acceptCb = [this] (std::string const& marshalTag) { + if (marshalTag.empty()) + return true; + std::string prefix = is_return ? "return: " : ""; return as_generator("[" << prefix << marshalTag << "]").generate(sink, nullptr, *context); }; |