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

Unified Diff: content/public/test/mock_render_process_host.cc

Issue 181013016: fixed issue 349227: Uninit error due to DuplicateHandle failure - add check on DuplicateHandle and … (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: PTAL Created 6 years, 10 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: content/public/test/mock_render_process_host.cc
diff --git a/content/public/test/mock_render_process_host.cc b/content/public/test/mock_render_process_host.cc
index a2b058ad890d794dcd426dacaaa28b883157d13f..06573ad7383d03608e22dceb4a69b25f9880d42a 100644
--- a/content/public/test/mock_render_process_host.cc
+++ b/content/public/test/mock_render_process_host.cc
@@ -143,9 +143,13 @@ bool MockRenderProcessHost::Send(IPC::Message* msg) {
TransportDIB* MockRenderProcessHost::MapTransportDIB(TransportDIB::Id dib_id) {
#if defined(OS_WIN)
- HANDLE duped;
- DuplicateHandle(GetCurrentProcess(), dib_id.handle, GetCurrentProcess(),
- &duped, 0, TRUE, DUPLICATE_SAME_ACCESS);
+ // NULL should be used here instead of INVALID_HANDLE_VALUE (or pseudo-handle)
+ // except for when dealing with the small number of Win16-derived APIs
+ // that require INVALID_HANDLE_VALUE (e.g. CreateFile and friends).
+ HANDLE duped = NULL;
+ if (!DuplicateHandle(GetCurrentProcess(), dib_id.handle, GetCurrentProcess(),
+ &duped, 0, TRUE, DUPLICATE_SAME_ACCESS))
+ duped = NULL;
return TransportDIB::Map(duped);
#elif defined(TOOLKIT_GTK)
return TransportDIB::Map(dib_id.shmkey);
« 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