public void InitEngine() { engine.Dispose(); engine = new V8Engine(); commands = new Command(this); engine.GlobalObject.SetProperty("Plugin", this, "Plugin", null, ScriptMemberSecurity.Locked); engine.GlobalObject.SetProperty("Command", commands, "Command", true, ScriptMemberSecurity.Locked); }
/// <summary> /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged /// resources. /// </summary> public void Dispose() { GC.SuppressFinalize(this); if (null != _engine) { _engine.Dispose(); _engine = null; } }
public void Dispose() { if (!isDisposing && !v8.IsDisposed) { isDisposing = true; ExecuteGlobalScriptFunction("shutdown"); // SHUTDOWN all scripts GC.WaitForPendingFinalizers(); GC.Collect(); v8.ForceV8GarbageCollection(); v8.Dispose(); // Notify engine that we have terminated OnShutdown(); } }