/// <summary>
        /// OnDisable - Make sure to release all SDK instances and alocated memory to avoid read access error
        /// </summary>
        void OnDisable()
        {
            if (m_blob != null)
            {
                m_blob.Dispose();
                m_blob = null;
            }

            if (m_contour != null)
            {
                m_contour.Dispose();
                m_contour = null;
            }
            if (sm != null)
            {
                sm.Close();
                sm.Dispose();
                sm = null;
            }
        }
Exemplo n.º 2
0
        void OnDisable()
        {
            //Disposses all modules

            Initialized = false;
            if (SenseManager == null)
            {
                return;
            }

            DisposeFunctions.ForEach(i => i.DynamicInvoke());

            if (FaceModuleOutput != null)
            {
                FaceModuleOutput.Dispose();
                FaceModuleOutput = null;
            }
            if (HandDataOutput != null)
            {
                SenseManager.PauseHand(true);
                HandDataOutput.Dispose();
                HandDataOutput = null;
            }
            if (ImageRgbOutput != null)
            {
                ImageRgbOutput.Dispose();
                ImageRgbOutput = null;
            }
            if (ImageDepthOutput != null)
            {
                ImageDepthOutput.Dispose();
                ImageDepthOutput = null;
            }

            if (ImageIROutput != null)
            {
                ImageIROutput.Dispose();
                ImageIROutput = null;
            }

            if (Image3DSegmentationOutput != null)
            {
                Image3DSegmentationOutput.Dispose();
                Image3DSegmentationOutput = null;
            }

            if (Projection != null)
            {
                Projection.Dispose();
                Projection = null;
            }

            if (BlobExtractor != null)
            {
                BlobExtractor.Dispose();
                BlobExtractor = null;
            }

            UvMap = null;

            PointCloud = null;

            SenseManager.Dispose();
            SenseManager = null;
        }