Example #1
0
        private void Dispose(bool disposing)
        {
            if (!disposed)
            {
                disposed = true;

                foreach (FTSize s in childSizes)
                    s.Dispose();

                childSizes.Clear();

                Error err = FT.FT_Done_Face(reference);

                if (err != Error.Ok)
                    throw new FreeTypeException(err);

                // removes itself from the parent Library, with a check to prevent this from happening when Library is
                // being disposed (Library disposes all it's children with a foreach loop, this causes an
                // InvalidOperationException for modifying a collection during enumeration)
                if (!parentLibrary.IsDisposed)
                    parentLibrary.RemoveChildFace(this);

                reference = IntPtr.Zero;
                rec = null;

                if (memoryFaceHandle.IsAllocated)
                    memoryFaceHandle.Free();
            }
        }
Example #2
0
        private void Dispose(bool disposing)
        {
            if (!disposed)
            {
                disposed = true;

                foreach (FTSize s in childSizes)
                    s.Dispose();

                childSizes.Clear();

                FT.FT_Done_Face(base.Reference);

                // removes itself from the parent Library, with a check to prevent this from happening when Library is
                // being disposed (Library disposes all it's children with a foreach loop, this causes an
                // InvalidOperationException for modifying a collection during enumeration)
                if (!parentLibrary.IsDisposed)
                    parentLibrary.RemoveChildFace(this);

                base.Reference = IntPtr.Zero;
                rec = new FaceRec();

                if (memoryFaceHandle.IsAllocated)
                    memoryFaceHandle.Free();

                EventHandler handler = Disposed;
                if (handler != null)
                    handler(this, EventArgs.Empty);
            }
        }