diff options
-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> |