Adding Release() codegen for func ptrs for passed args disposing
Publish PHP Package / docker (push) Successful in 6s Details

This commit is contained in:
Pavel Shevaev 2024-11-15 16:17:13 +03:00
parent 5f9d155d1f
commit d8c72c3e99
1 changed files with 8 additions and 3 deletions

View File

@ -379,6 +379,10 @@ Script_{{o.name|norm_name}}.Method_{{m.name}}.ReturnValue(frm, stack
{{arg_prefix}}{{arg.name}} = default;
{% endif %}
{%- if arg.type is instanceof('\\mtgMetaFunc') -%}
{{arg_prefix}}{{arg.name}}?.Release();
{{arg_prefix}}{{arg.name}} = default;
{% endif %}
{%- endfor ~%}
{%- endmacro -%}
@ -425,11 +429,12 @@ Script_{{o.name|norm_name}}.Method_{{m.name}}.ReturnValue(frm, stack
{{native}} = {{value}}
{# bhl functor special case #}
{%- elseif type == "ConfScript" -%}
{{native}}.fct.obj = {{value}}.obj
{{native}}.fct.obj = {{value}}._obj
{%- else -%}
{%- if type is instanceof('\\mtgMetaFunc') -%}
{{native}} = (VM.FuncPtr){{value}}.obj;{{native}}.Retain()
{{native}} = (VM.FuncPtr){{value}}._obj;
{{native}}.Retain()
{%- endif -%}
{%- if type is instanceof('\\mtgArrType') -%}
@ -439,7 +444,7 @@ Script_{{o.name|norm_name}}.Method_{{m.name}}.ReturnValue(frm, stack
{%~ if type == 'any[]'-%}
{{native}} = (ValList){{value}}._obj;
{{native}}.Retain();
{{native}}.Retain()
{%~ else ~%}