aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBill Welden <bwelden@imvu.com>2013-02-26 08:53:03 -0800
committerJukka Jylänki <jujjyl@gmail.com>2013-04-12 14:24:21 +0300
commit8e471a05c1d2e00a3d367cff36cb3788b9681491 (patch)
treea41787eb8717dc64b5e8cadd8acdf0e03753d428
parent136c2c4457c87d5dbe9477b28b84362dd5a48b64 (diff)
Fixed a problem where auto downcasting from a smart pointer to a derived class for which no smart pointer was registered would cause a crash.
Now a smart pointer is only downcast to the most derived class which is bound and for which a smart pointer is registered.
-rwxr-xr-xsrc/embind/embind.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/embind/embind.js b/src/embind/embind.js
index 5a49d177..277515a5 100755
--- a/src/embind/embind.js
+++ b/src/embind/embind.js
@@ -619,7 +619,7 @@ RegisteredPointer.prototype.getDynamicDowncastType = function(ptr) {
var derivation = Module.__getDerivationPath(type, this.pointeeType.rawType);
for (var i = 0; i < derivation.size(); i++) {
downcastType = typeRegistry[derivation.at(i)];
- if (downcastType) {
+ if (downcastType && (!this.isSmartPointer || downcastType.smartPointerType)) {
break;
}
}