Example #1
0
        private void Dispose(bool disposing)
        {
            if (disposing)
            {
                api_.JsSetCurrentContext(JavaScriptEngineSafeHandle.Invalid);
                api_.JsSetRuntimeMemoryAllocationCallback(this.handle_, IntPtr.Zero, IntPtr.Zero);
                if (childEngines_ != null)
                {
                    foreach (var engineRef in childEngines_)
                    {
                        JavaScriptEngine engine;
                        if (engineRef.TryGetTarget(out engine))
                        {
                            engine.Dispose();
                        }
                    }
                    childEngines_ = null;
                }

                if (handle_ != null && !handle_.IsClosed)
                {
                    handle_.Dispose();
                    handle_ = null;
                }
            }
        }
 private void Dispose(bool disposing)
 {
     if (disposing)
     {
         if (handle_ != null)
         {
             handle_.Dispose();
             handle_ = null;
         }
     }
 }