aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChad Austin <chad@imvu.com>2013-03-07 15:42:13 -0800
committerJukka Jylänki <jujjyl@gmail.com>2013-04-12 14:25:11 +0300
commit6a0976ce2e1006cda317625e294aa878045e305a (patch)
treea1442219595ce0b43be79f1ac720cda42f3c22d7 /src
parent612340cec2f3761efffc450e1de0adb445a45036 (diff)
checkpoint work towards unifying the binding type for classes and smart pointers.
Diffstat (limited to 'src')
-rwxr-xr-xsrc/embind/embind.js8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/embind/embind.js b/src/embind/embind.js
index 5d6e6c21..83c3841f 100755
--- a/src/embind/embind.js
+++ b/src/embind/embind.js
@@ -491,7 +491,13 @@ RegisteredPointer.prototype.isPolymorphic = function() {
RegisteredPointer.prototype.toWireType = function(destructors, handle) {
var fromRawType;
if (handle === null) {
- return 0; // todo: maybe this should return a zero-initialized smart pointer object
+ if (this.isSmartPointer) {
+ var ptr = this.rawConstructor(0, 0);
+ destructors.push(this.rawDestructor, ptr);
+ return ptr;
+ } else {
+ return 0;
+ }
}
if (!(handle instanceof ClassHandle)) {
throwBindingError('Expected pointer or null, got ' + IMVU.repr(handle));