コード例 #1
0
        public void Destroy()
        {
            try
            {
                _instance = null;
                if (_ctx != null)
                {
                    var ctx = _ctx.rawValue;
                    _ctx.Destroy();
                    _ctx            = null;
                    _lastContextPtr = IntPtr.Zero;
                    _lastContext    = null;
                    _contexts.Clear();
                    _objectCache.Clear();
                    DuktapeDLL.duk_unity_destroy_heap(ctx);
                    // Debug.LogWarning("duk_destroy_heap");
                }

                if (_updateTimer != 0)
                {
                    DuktapeRunner.Clear(_updateTimer);
                    _updateTimer = 0;
                }
            }
            finally
            {
                if (_memAllocPool != IntPtr.Zero)
                {
                    Marshal.FreeHGlobal(_memAllocPool);
                    _memAllocPool = IntPtr.Zero;
                }
            }
        }
コード例 #2
0
 public static int ClearTimer(IntPtr ctx)
 {
     if (DuktapeDLL.duk_is_number(ctx, 0))
     {
         var id = DuktapeDLL.duk_get_uint(ctx, 0);
         DuktapeDLL.duk_push_boolean(ctx, DuktapeRunner.Clear(id));
         return(1);
     }
     return(0);
 }
コード例 #3
0
 private void Stop()
 {
     lock (_pending)
     {
         _pending.Clear();
     }
     DetachCurrent();
     if (_client != null)
     {
         _client.Close();
         _client = null;
     }
     if (_server != null)
     {
         _server.Close();
         _server = null;
     }
     DuktapeRunner.Clear(_loop);
     _loop = 0;
 }
コード例 #4
0
ファイル: DuktapeVM.cs プロジェクト: alyron/duktape-framework
        public void Destroy()
        {
            _instance = null;
            if (_ctx != null)
            {
                var ctx = _ctx.rawValue;
                _ctx.onDestroy();
                _ctx            = null;
                _lastContextPtr = IntPtr.Zero;
                _lastContext    = null;
                _contexts.Clear();
                _objectCache.Clear();
                DuktapeDLL.duk_destroy_heap_default(ctx);
                // Debug.LogWarning("duk_destroy_heap");
            }

            if (_updateTimer != 0)
            {
                DuktapeRunner.Clear(_updateTimer);
                _updateTimer = 0;
            }
        }