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

Unified Diff: chrome/app/close_handle_hook_win.cc

Issue 1343873002: Check for CloseHandle failures even when not debugging (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: DPCHECK instead of DCHECK Created 5 years, 3 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/app/close_handle_hook_win.cc
diff --git a/chrome/app/close_handle_hook_win.cc b/chrome/app/close_handle_hook_win.cc
index 02dfce513d13f9c0ba084cdc6bf0ec77ed2f6fd4..cde247eee44f1acf6ef08124cb97c0f957e04b64 100644
--- a/chrome/app/close_handle_hook_win.cc
+++ b/chrome/app/close_handle_hook_win.cc
@@ -37,7 +37,13 @@ DuplicateHandleType g_duplicate_function = NULL;
// function.
BOOL WINAPI CloseHandleHook(HANDLE handle) {
base::win::OnHandleBeingClosed(handle);
- return g_close_function(handle);
+ BOOL result = g_close_function(handle);
+ // Check for CloseHandle failures.
+ // urlmon closes a handle that is NULL so we can't fail on that.
+ // Also CloseHandle() under a debugger only throws an exception on handles
+ // that are neither NULL nor INVALID_HANDLE_VALUE.
+ DPCHECK(result || handle == NULL || handle == INVALID_HANDLE_VALUE);
rvargas (doing something else) 2015/09/15 18:08:04 This seems like a weird place to looks for close f
+ return result;
}
BOOL WINAPI DuplicateHandleHook(HANDLE source_process,
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698