diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/embind/embind.js | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/src/embind/embind.js b/src/embind/embind.js index 790c0970..56f3520a 100644 --- a/src/embind/embind.js +++ b/src/embind/embind.js @@ -389,12 +389,6 @@ function __embind_register_smart_ptr( clone.count.value += 1; return clone; }; - - Handle.prototype.move = function() { - var rv = this.clone(); - this.delete(); - return rv; - }; Handle.prototype['delete'] = function() { if (!this.ptr) { @@ -435,6 +429,20 @@ function __embind_register_class( Handle.prototype.clone = function() { if (!this.ptr) { + throw new BindingError(pointeeType.name + ' instance already deleted'); + } + + var clone = Object.create(Handle.prototype); + clone.count = this.count; + clone.smartPointer = this.smartPointer; + clone.ptr = this.ptr; + + clone.count.value += 1; + return clone; + }; + + Handle.prototype.clone = function() { + if (!this.ptr) { throw new BindingError(classType.name + ' instance already deleted'); } |