Merge pull request #98467 from zaevi/fix_csharp_stringname_leak

C#: Fix StringName leak when converting `Variant` to `Signal` / `Callable`
This commit is contained in:
Thaddeus Crews 2024-11-12 09:27:49 -06:00
commit 0dd003d7d2
No known key found for this signature in database
GPG Key ID: 62181B86FE9E5D84

View File

@ -534,7 +534,10 @@ namespace Godot.NativeInterop
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Callable ConvertToCallable(in godot_variant p_var)
=> Marshaling.ConvertCallableToManaged(ConvertToNativeCallable(p_var));
{
using var callable = ConvertToNativeCallable(p_var);
return Marshaling.ConvertCallableToManaged(callable);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static godot_signal ConvertToNativeSignal(in godot_variant p_var)
@ -542,7 +545,10 @@ namespace Godot.NativeInterop
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Signal ConvertToSignal(in godot_variant p_var)
=> Marshaling.ConvertSignalToManaged(ConvertToNativeSignal(p_var));
{
using var signal = ConvertToNativeSignal(p_var);
return Marshaling.ConvertSignalToManaged(signal);
}
public static godot_array ConvertToNativeArray(in godot_variant p_var)
=> p_var.Type == Variant.Type.Array ?