private void Dispose(bool disposing) { if (!disposed) { disposed = true; //only dispose the user allocated sizes that are not duplicates. if (userAlloc && !duplicate) { Error err = FT.FT_Done_Size(reference); if (err != Error.Ok) { throw new FreeTypeException(err); } } // removes itself from the parent Face, with a check to prevent this from happening when Face is // being disposed (Face disposes all it's children with a foreach loop, this causes an // InvalidOperationException for modifying a collection during enumeration) if (parentFace != null && !parentFace.IsDisposed) { parentFace.RemoveChildSize(this); } reference = IntPtr.Zero; rec = null; } }
private void Dispose(bool disposing) { if (!disposed) { disposed = true; //only dispose the user allocated sizes that are not duplicates. if (userAlloc && !duplicate) { FT.FT_Done_Size(reference); } // removes itself from the parent Face, with a check to prevent this from happening when Face is // being disposed (Face disposes all it's children with a foreach loop, this causes an // InvalidOperationException for modifying a collection during enumeration) if (parentFace != null && !parentFace.IsDisposed) { parentFace.RemoveChildSize(this); } reference = IntPtr.Zero; rec = new SizeRec(); EventHandler handler = Disposed; if (handler != null) { handler(this, EventArgs.Empty); } } }