Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(301)

Unified Diff: runtime/bin/process_win.cc

Issue 2760293002: [dart:io] Adds a finalizer to _NativeSocket to avoid socket leaks (Closed)
Patch Set: Add asserts Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: runtime/bin/process_win.cc
diff --git a/runtime/bin/process_win.cc b/runtime/bin/process_win.cc
index 7903236a0164e4a98365ebf572d97aab1047298e..5d976238052e8df41ab973e766cf6b9b2154369b 100644
--- a/runtime/bin/process_win.cc
+++ b/runtime/bin/process_win.cc
@@ -946,7 +946,9 @@ static Mutex* signal_mutex = new Mutex();
SignalInfo::~SignalInfo() {
- reinterpret_cast<FileHandle*>(fd_)->Close();
+ FileHandle* file_handle = reinterpret_cast<FileHandle*>(fd_);
+ file_handle->Close();
+ file_handle->Release();
}
@@ -1005,7 +1007,7 @@ intptr_t Process::SetSignalHandler(intptr_t signal) {
if (signal_handlers == NULL) {
if (SetConsoleCtrlHandler(SignalHandler, true) == 0) {
int error_code = GetLastError();
- delete write_handle;
+ write_handle->Release();
zra 2017/03/25 22:39:50 // Since SetConsoleCtrlHandler failed, the IO comp
CloseProcessPipe(fds);
SetLastError(error_code);
return -1;
@@ -1038,6 +1040,8 @@ void Process::ClearSignalHandler(intptr_t signal) {
if (signal_handlers == NULL) {
USE(SetConsoleCtrlHandler(SignalHandler, false));
}
+ FileHandle* file_handle = reinterpret_cast<FileHandle*>(handler->fd());
+ file_handle->Release();
}
delete handler;
}

Powered by Google App Engine
This is Rietveld 408576698