From 16c0a9ca7c2dab14187849e816bc1f8e99a3152f Mon Sep 17 00:00:00 2001 From: Marshall Greenblatt Date: Mon, 29 Jul 2013 17:38:35 +0000 Subject: [PATCH] Windows: Force child processes to exit on main process termination (issue #1011). git-svn-id: https://chromiumembedded.googlecode.com/svn/branches/1453@1349 5089003a-bbd8-11dd-ad1f-f1f9622dbc98 --- cef3/patch/patch.cfg | 6 ++++++ cef3/patch/patches/sandbox_1011.patch | 23 +++++++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 cef3/patch/patches/sandbox_1011.patch diff --git a/cef3/patch/patch.cfg b/cef3/patch/patch.cfg index 0fb397265..f3ac4be4c 100644 --- a/cef3/patch/patch.cfg +++ b/cef3/patch/patch.cfg @@ -61,6 +61,12 @@ patches = [ 'name': 'drag_handler_601', 'path': '../content/', }, + { + # Force child processes to exit on main process termination. + # http://code.google.com/p/chromiumembedded/issues/detail?id=1011 + 'name': 'sandbox_1011', + 'path': '../content/common/', + }, { # Fix crash on 10.6 when building with the 10.7 SDK # http://code.google.com/p/chromiumembedded/issues/detail?id=1026 diff --git a/cef3/patch/patches/sandbox_1011.patch b/cef3/patch/patches/sandbox_1011.patch new file mode 100644 index 000000000..bafad7d73 --- /dev/null +++ b/cef3/patch/patches/sandbox_1011.patch @@ -0,0 +1,23 @@ +Index: sandbox_win.cc +=================================================================== +--- sandbox_win.cc (revision 202711) ++++ sandbox_win.cc (working copy) +@@ -589,8 +589,17 @@ + cmd_line->AppendArg(base::StringPrintf("/prefetch:%d", base::Hash(type_str))); + + if (!in_sandbox) { ++ base::LaunchOptions options = base::LaunchOptions(); + base::ProcessHandle process = 0; +- base::LaunchProcess(*cmd_line, base::LaunchOptions(), &process); ++ ++ static HANDLE hJobObject = NULL; ++ if (!hJobObject) { ++ hJobObject = CreateJobObject(NULL, NULL); ++ base::SetJobObjectAsKillOnJobClose(hJobObject); ++ } ++ options.job_handle = hJobObject; ++ ++ base::LaunchProcess(*cmd_line, options, &process); + g_broker_services->AddTargetPeer(process); + return process; + }