예제 #1
0
        public override void Close()
        {
            debugStackFrameSniffer       = null;
            activeScriptGarbageCollector = null;
            activeScriptDebug            = null;
            activeScriptParse            = null;

            RawCOMHelpers.ReleaseAndEmpty(ref pDebugStackFrameSniffer);
            RawCOMHelpers.ReleaseAndEmpty(ref pActiveScriptGarbageCollector);
            RawCOMHelpers.ReleaseAndEmpty(ref pActiveScriptDebug);
            RawCOMHelpers.ReleaseAndEmpty(ref pActiveScriptParse);
            RawCOMHelpers.ReleaseAndEmpty(ref pActiveScript);

            activeScript.Close();
            Marshal.FinalReleaseComObject(activeScript);
            activeScript = null;
        }
예제 #2
0
        /// <summary>
        /// Destroys object
        /// </summary>
        /// <param name="disposing">Flag, allowing destruction of
        /// managed objects contained in fields of class</param>
        private void Dispose(bool disposing)
        {
            if (_disposedFlag.Set())
            {
                _dispatcher.Invoke(() =>
                {
                    if (_dispatch != null)
                    {
                        ComHelpers.ReleaseComObject(ref _dispatch, !disposing);
                        _dispatch = null;
                    }

                    _activeScriptGarbageCollector = null;
                    ComHelpers.ReleaseAndEmpty(ref _pActiveScriptGarbageCollector);

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

                    if (_activeScript != null)
                    {
                        _activeScript.Close();
                        Marshal.FinalReleaseComObject(_activeScript);
                        _activeScript = null;
                    }

                    ComHelpers.ReleaseAndEmpty(ref _pActiveScript);
                });

                if (disposing)
                {
                    if (_hostItems != null)
                    {
                        _hostItems.Clear();
                    }

                    _lastException = null;
                }
            }
        }
        private void InnerDispose()
        {
            if (!_disposed)
            {
                _disposed = true;

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

                if (_activeScript != null)
                {
                    _activeScript.Close();
                    _activeScript = null;
                }

                ComHelpers.ReleaseAndEmpty(ref _pActiveScript);
            }
        }
예제 #4
0
        /// <summary>
        /// Disposes the internal IActiveScript engine instance.
        /// </summary>
        /// <param name="managedDispose">Whether to dispose only managed resources.</param>
        protected virtual void Dispose(bool managedDispose)
        {
            if (activeScript != null)
            {
                try
                {
                    activeScript.Close();
                }
                finally
                {
                    activeScript = null;
                }
            }

            if (parser != null)
            {
                parser = null;
            }

            if (scriptSite != null)
            {
                scriptSite = null;
            }
        }