diff options
author | Todd Lee <tlee@imvu.com> | 2012-10-23 12:23:03 -0700 |
---|---|---|
committer | Jukka Jylänki <jujjyl@gmail.com> | 2013-04-12 14:21:18 +0300 |
commit | d0bf1b0aea625931255c31641ba53ad6d4cee7c3 (patch) | |
tree | 4dd26767b9c7ef2c03c299dab189f450c5bdce41 /src | |
parent | 681ea9fc51ee9908008f0913356f673018c11c2e (diff) |
Handle shared_ptr correctly.(keep underlying pointer point to the same address)
There was some global variable dependency. These bleed thru tests and affected test result. Adding a way to reset this state.
Diffstat (limited to 'src')
-rw-r--r-- | src/embind/embind.js | 2 | ||||
-rw-r--r-- | src/embind/emval.js | 5 |
2 files changed, 6 insertions, 1 deletions
diff --git a/src/embind/embind.js b/src/embind/embind.js index 56f3520a..f63a8eff 100644 --- a/src/embind/embind.js +++ b/src/embind/embind.js @@ -409,7 +409,7 @@ function __embind_register_smart_ptr( return new Handle(ptr); }, toWireType: function(destructors, o) { - return o.ptr; + return o.smartPointer; } }; } diff --git a/src/embind/emval.js b/src/embind/emval.js index 9574ab37..26ceaf46 100644 --- a/src/embind/emval.js +++ b/src/embind/emval.js @@ -13,12 +13,17 @@ Module.count_emval_handles = function() { return _emval_handle_array.length; }; +Module.reset_emval_handles = function() { + _emval_handle_array = []; + _emval_free_list = []; +} // Private C++ API function __emval_register(value) { var handle = _emval_free_list.length ? _emval_free_list.pop() : _emval_handle_array.length; + _emval_handle_array[handle] = {refcount: 1, value: value}; return handle; } |