Fixes memory leaks

This commit is contained in:
Deukhoofd 2020-05-02 20:30:33 +02:00
parent 35388de524
commit 25d72e14f9
Signed by: Deukhoofd
GPG Key ID: F63E044490819F6F
2 changed files with 4 additions and 5 deletions

View File

@ -62,10 +62,10 @@ namespace PkmnLibSharp.Library
{
fixed (IntPtr* hab = hiddenAbilitiesConverted)
{
var ptr = SpeciesVariant.Construct(name, height, weight, baseExperience, (IntPtr)t,
var ptr = SpeciesVariant.Construct(name, height, weight, baseExperience, (IntPtr) t,
(ulong) types.Length,
baseHealth, baseAttack, baseDefense, baseSpecialAttack, baseSpecialDefense,
baseSpeed, (IntPtr)ab, (ulong) abilities.Length, (IntPtr)hab,
baseSpeed, (IntPtr) ab, (ulong) abilities.Length, (IntPtr) hab,
(ulong) hiddenAbilities.Length, IntPtr.Zero);
var f = new Forme(ptr);
foreach (var intPtr in abilitiesConverted)
@ -78,8 +78,7 @@ namespace PkmnLibSharp.Library
}
}
private Forme(IntPtr parent)
: base(parent)
private Forme(IntPtr parent) : base(parent)
{
}

View File

@ -5,7 +5,7 @@ namespace PkmnLibSharp
public abstract class PointerWrapper : IDisposable
{
internal readonly IntPtr Ptr;
private bool _isDeleted = true;
private bool _isDeleted = false;
protected PointerWrapper(IntPtr ptr)
{