Skip to content

Commit

Permalink
src: inherit first from AsyncWrap
Browse files Browse the repository at this point in the history
To make sure casting a class of multiple inheritance from a void* to
AsyncWrap succeeds make AsyncWrap the first inherited class.

PR-URL: #6184
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
  • Loading branch information
trevnorris committed May 24, 2016
1 parent e03c326 commit ddc19be
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/js_stream.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ using v8::Value;


JSStream::JSStream(Environment* env, Local<Object> obj, AsyncWrap* parent)
: StreamBase(env),
AsyncWrap(env, obj, AsyncWrap::PROVIDER_JSSTREAM, parent) {
: AsyncWrap(env, obj, AsyncWrap::PROVIDER_JSSTREAM, parent),
StreamBase(env) {
node::Wrap(obj, this);
MakeWeak<JSStream>(this);
}
Expand Down
2 changes: 1 addition & 1 deletion src/js_stream.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

namespace node {

class JSStream : public StreamBase, public AsyncWrap {
class JSStream : public AsyncWrap, public StreamBase {
public:
static void Initialize(v8::Local<v8::Object> target,
v8::Local<v8::Value> unused,
Expand Down
6 changes: 3 additions & 3 deletions src/node_crypto.h
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ class SSLWrap {
// Connection inherits from AsyncWrap because SSLWrap makes calls to
// MakeCallback, but SSLWrap doesn't store the handle itself. Instead it
// assumes that any args.This() called will be the handle from Connection.
class Connection : public SSLWrap<Connection>, public AsyncWrap {
class Connection : public AsyncWrap, public SSLWrap<Connection> {
public:
~Connection() override {
#ifdef SSL_CTRL_SET_TLSEXT_SERVERNAME_CB
Expand Down Expand Up @@ -387,8 +387,8 @@ class Connection : public SSLWrap<Connection>, public AsyncWrap {
v8::Local<v8::Object> wrap,
SecureContext* sc,
SSLWrap<Connection>::Kind kind)
: SSLWrap<Connection>(env, sc, kind),
AsyncWrap(env, wrap, AsyncWrap::PROVIDER_CRYPTO),
: AsyncWrap(env, wrap, AsyncWrap::PROVIDER_CRYPTO),
SSLWrap<Connection>(env, sc, kind),
bio_read_(nullptr),
bio_write_(nullptr),
hello_offset_(0) {
Expand Down

0 comments on commit ddc19be

Please sign in to comment.