diff options
author | Todd Lee <tlee@imvu.com> | 2012-12-18 15:02:40 -0800 |
---|---|---|
committer | Jukka Jylänki <jujjyl@gmail.com> | 2013-04-12 14:22:37 +0300 |
commit | 0e3ca9c9d67dfa7efd95d97d3c1a5d0edc6fdb24 (patch) | |
tree | 3a809e13f7bf260370397cc0564995bb1cd0ac3a | |
parent | a7733270b037dcb2e2cf97ecd17ce76f3d4a2da9 (diff) |
add ability for descendent to clone interface
-rwxr-xr-x | system/include/emscripten/bind.h | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/system/include/emscripten/bind.h b/system/include/emscripten/bind.h index 48a0fd58..56a3b62c 100755 --- a/system/include/emscripten/bind.h +++ b/system/include/emscripten/bind.h @@ -887,9 +887,7 @@ namespace emscripten { wrapper() {} // to avoid error "call to implicitly deleted construrtor..." wrapper(InterfaceType* interface) { - // why dynamic_cast causes javascript crash? - wrapper<InterfaceType>* iw = static_cast<wrapper<InterfaceType>*>(interface); - jsobj = iw->jsobj; + cloneInterface(interface); } // Not necessary in any example so far, but appeases a compiler warning. @@ -919,6 +917,13 @@ namespace emscripten { return Caller<ReturnType, Args...>::call(*jsobj, name, args...); } + protected: + void cloneInterface(InterfaceType* interface) { + // why dynamic_cast causes javascript crash? + wrapper<InterfaceType>* iw = static_cast<wrapper<InterfaceType>*>(interface); + jsobj = iw->jsobj; + } + private: // this class only exists because you can't partially specialize function templates template<typename ReturnType, typename... Args> |