src/cxx_supportlib/ServerKit/ClientRef.h in passenger-5.3.4 vs src/cxx_supportlib/ServerKit/ClientRef.h in passenger-5.3.5

- old
+ new

@@ -78,13 +78,17 @@ } } explicit ClientRef(BOOST_RV_REF(ClientRef) ref) - : client(ref.client) + : client(ref.client), + file(ref.file), + line(ref.line) { ref.client = NULL; + ref.file = NULL; + ref.line = 0; } ~ClientRef() { if (client != NULL) { getServer(client)->_unrefClient(client, file, line); @@ -94,11 +98,11 @@ Client *get() const { return client; } ClientRef &operator=(BOOST_COPY_ASSIGN_REF(ClientRef) ref) { - if (client == ref.client) { + if (this != &ref) { Client *oldClient = client; const char *oldFile = file; unsigned int oldLine = line; client = ref.client; file = ref.file; @@ -112,14 +116,20 @@ } return *this; } ClientRef &operator=(BOOST_RV_REF(ClientRef) ref) { - Client *oldClient = client; - client = ref.client; - ref.client = NULL; - if (oldClient != NULL) { - getServer(oldClient)->_unrefClient(oldClient, file, line); + if (this != &ref) { + Client *oldClient = client; + client = ref.client; + file = ref.file; + line = ref.line; + ref.client = NULL; + ref.file = NULL; + ref.line = 0; + if (oldClient != NULL) { + getServer(oldClient)->_unrefClient(oldClient, file, line); + } } return *this; } };