func NewValue(engine_ *Engine, self_ unsafe.Pointer) *Value { if self_ == nil { return nil } valueId++ id_ := valueId val_ := &Value{ engine: engine_, self: self_, disposed: false, id: id_, } engine_.SetAliveValue(id_, val_) runtime.SetFinalizer(val_, func(v *Value) { if traceDispose { println("v8.Value.Dispose()") } if !v.disposed { //C.V8_DisposeValue(v.self) C.V8_Engine_DisposeValue(v.self) } }) return val_ }
func (val_ *Value) Disposed() { if val_.disposed { return } engine_ := val_.GetEngine() id_ := val_.id val_.disposed = true delete(engine_.aliveValue, id_) C.V8_Engine_DisposeValue(val_.self) }