diff options
Diffstat (limited to 'src/embind/embind.js')
-rwxr-xr-x | src/embind/embind.js | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/embind/embind.js b/src/embind/embind.js index 03af7010..b8bd5fcf 100755 --- a/src/embind/embind.js +++ b/src/embind/embind.js @@ -640,9 +640,15 @@ RegisteredPointer.prototype.toWireType = function(destructors, handle) { return 0; } } + if (!(handle instanceof this.registeredClass.constructor)) { throwBindingError('Expected null or instance of ' + this.name + ', got ' + _embind_repr(handle)); } + + if (!handle.$$.ptr) { + throwBindingError('Cannot pass deleted object'); + } + // TODO: this is not strictly true // We could support BY_EMVAL conversions from raw pointers to smart pointers // because the smart pointer can hold a reference to the handle @@ -1079,8 +1085,6 @@ function __embind_register_class_function( throwBindingError(humanName + ' called with ' + arguments.length + ' arguments, expected ' + (argCount-2)); } - validateThis(this, classType, humanName); - var destructors = []; var args = new Array(argCount + 1); args[0] = context; |