diff options
author | Justin Berger <j.david.berger@gmail.com> | 2017-07-19 18:47:01 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2017-08-31 19:35:03 (GMT) |
commit | 546a58746967d10996075ca47a7198c1c375fdb2 (patch) | |
tree | 34c4e2f757e1cbeac3dc07c1dd5d06398821ba68 /Source/cmPipeConnection.cxx | |
parent | 9bad65940c87f594a5f1007019d4b187068dbce0 (diff) | |
download | CMake-546a58746967d10996075ca47a7198c1c375fdb2.zip CMake-546a58746967d10996075ca47a7198c1c375fdb2.tar.gz CMake-546a58746967d10996075ca47a7198c1c375fdb2.tar.bz2 |
server: Fixed mismatched new/delete; added proper shutdown procedure
Diffstat (limited to 'Source/cmPipeConnection.cxx')
-rw-r--r-- | Source/cmPipeConnection.cxx | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/Source/cmPipeConnection.cxx b/Source/cmPipeConnection.cxx index b18a1d6..9e565f6 100644 --- a/Source/cmPipeConnection.cxx +++ b/Source/cmPipeConnection.cxx @@ -19,7 +19,8 @@ void cmPipeConnection::Connect(uv_stream_t* server) uv_pipe_init(this->Server->GetLoop(), rejectPipe, 0); uv_accept(server, reinterpret_cast<uv_stream_t*>(rejectPipe)); - uv_close(reinterpret_cast<uv_handle_t*>(rejectPipe), &on_close_delete); + uv_close(reinterpret_cast<uv_handle_t*>(rejectPipe), + &on_close_delete<uv_pipe_t>); return; } @@ -28,7 +29,8 @@ void cmPipeConnection::Connect(uv_stream_t* server) this->ClientPipe->data = static_cast<cmEventBasedConnection*>(this); auto client = reinterpret_cast<uv_stream_t*>(this->ClientPipe); if (uv_accept(server, client) != 0) { - uv_close(reinterpret_cast<uv_handle_t*>(client), &on_close_delete); + uv_close(reinterpret_cast<uv_handle_t*>(client), + &on_close_delete<uv_pipe_t>); this->ClientPipe = nullptr; return; } @@ -65,15 +67,16 @@ bool cmPipeConnection::OnConnectionShuttingDown() { if (this->ClientPipe) { uv_close(reinterpret_cast<uv_handle_t*>(this->ClientPipe), - &on_close_delete); + &on_close_delete<uv_pipe_t>); this->WriteStream->data = nullptr; } - uv_close(reinterpret_cast<uv_handle_t*>(this->ServerPipe), &on_close_delete); + uv_close(reinterpret_cast<uv_handle_t*>(this->ServerPipe), + &on_close_delete<uv_pipe_t>); this->ClientPipe = nullptr; this->ServerPipe = nullptr; this->WriteStream = nullptr; this->ReadStream = nullptr; - return cmConnection::OnConnectionShuttingDown(); + return cmEventBasedConnection::OnConnectionShuttingDown(); } |