aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rwxr-xr-xsrc/embind/embind.js19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/embind/embind.js b/src/embind/embind.js
index 520ca269..de87dceb 100755
--- a/src/embind/embind.js
+++ b/src/embind/embind.js
@@ -661,6 +661,14 @@ function RegisteredClass(
this.downcast = downcast;
}
+function shallowCopy(o) {
+ var rv = {};
+ for (var k in o) {
+ rv[k] = o[k];
+ }
+ return rv;
+}
+
function __embind_register_class(
rawType,
rawPointerType,
@@ -726,10 +734,7 @@ function __embind_register_class(
var clone = Object.create(Handle.prototype);
Object.defineProperty(clone, '$$', {
- value: {
- count: this.$$.count,
- ptr: this.$$.ptr,
- },
+ value: shallowCopy(this.$$),
});
clone.$$.count.value += 1;
@@ -998,11 +1003,7 @@ function __embind_register_smart_ptr(
var clone = Object.create(Handle.prototype);
Object.defineProperty(clone, '$$', {
- value: {
- count: this.$$.count,
- smartPtr: this.$$.smartPtr,
- ptr: this.$$.ptr,
- },
+ value: shallowCopy(this.$$),
});
clone.$$.count.value += 1;