/// <summary>
        /// Actually releases native resource(s).
        /// </summary>
        private void OnReleaseUnmanaged()
        {
            CubismMemory.DeallocateUnmanaged(UnmanagedModel);
            Moc.ReleaseUnmanagedMoc();


            UnmanagedModel = IntPtr.Zero;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Releases native handle.
        /// </summary>
        public void ReleaseUnmanagedMoc()
        {
            --ReferenceCount;


            // Free unmanaged memory in case the instance isn't referenced any longer.
            if (ReferenceCount == 0)
            {
                CubismMemory.DeallocateUnmanaged(UnmanagedMoc);


                UnmanagedMoc = IntPtr.Zero;
            }


            // Deal with invalid reference counts.
            else if (ReferenceCount < 0)
            {
                ReferenceCount = 0;
            }
        }