Browse Source

Called Marshal.FreeHGlobal only if the instance was created by Marshal.AllocHGlobal.

Signed-off-by: Dimitar Dobrev <dpldobrev@yahoo.com>
pull/564/merge
Dimitar Dobrev 10 years ago
parent
commit
6380e5d7ea
  1. 3
      src/Generator/Generators/CSharp/CSharpTextTemplate.cs

3
src/Generator/Generators/CSharp/CSharpTextTemplate.cs

@ -1867,7 +1867,8 @@ namespace CppSharp.Generators.CSharp @@ -1867,7 +1867,8 @@ namespace CppSharp.Generators.CSharp
}
}
WriteLine("Marshal.FreeHGlobal({0});", Helpers.InstanceIdentifier);
WriteLine("if ({0})", Helpers.OwnsNativeInstanceIdentifier);
WriteLineIndent("Marshal.FreeHGlobal({0});", Helpers.InstanceIdentifier);
WriteCloseBraceIndent();
PopBlock(NewLineKind.BeforeNextBlock);

Loading…
Cancel
Save