diff options
Diffstat (limited to 'src/node_object_wrap.h')
-rw-r--r-- | src/node_object_wrap.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/node_object_wrap.h b/src/node_object_wrap.h index 5c6ab2865bd..683123559f6 100644 --- a/src/node_object_wrap.h +++ b/src/node_object_wrap.h @@ -56,7 +56,11 @@ class NODE_EXTERN ObjectWrap { static inline T* Unwrap(v8::Handle<v8::Object> handle) { assert(!handle.IsEmpty()); assert(handle->InternalFieldCount() > 0); - return static_cast<T*>(handle->GetAlignedPointerFromInternalField(0)); + // Cast to ObjectWrap before casting to T. A direct cast from void + // to T won't work right when T has more than one base class. + void* ptr = handle->GetAlignedPointerFromInternalField(0); + ObjectWrap* wrap = static_cast<ObjectWrap*>(ptr); + return static_cast<T*>(wrap); } |