Skip to content

Commit 4313c9a

Browse files
committed
BrowserSubprocess - Update shutdown priority (SetProcessShutdownParameters)
Issue cefsharp#3155
1 parent 51b2c74 commit 4313c9a

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

‎CefSharp.BrowserSubprocess.Core/BrowserSubprocessExecutable.h‎

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,25 @@ namespace CefSharp
120120

121121
// The Crashpad Handler doesn't have any HostProcessIdArgument, so we must not try to
122122
// parse it lest we want an ArgumentNullException.
123-
if (type != "crashpad-handler")
123+
if (type == "crashpad-handler")
124124
{
125+
//Lower the shutdown priority so the browser process is shutdown first (Issue #3155)
126+
//The system terminates the process without displaying a retry dialog box for the user.
127+
//Crashpad is lower than other sub processes so it can still monitor process exit crashes.
128+
if (!SetProcessShutdownParameters(0x100, SHUTDOWN_NORETRY))
129+
{
130+
LOG(ERROR) << "SetProcessShutdownParameters - Crashpad";
131+
}
132+
}
133+
else
134+
{
135+
//Lower the shutdown priority so the browser process is shutdown first (Issue #3155)
136+
//The system terminates the process without displaying a retry dialog box for the user.
137+
if (!SetProcessShutdownParameters(0x280 - 100, SHUTDOWN_NORETRY))
138+
{
139+
LOG(ERROR) << "SetProcessShutdownParameters - Sub Process";
140+
}
141+
125142
parentProcessId = int::Parse(CommandLineArgsParser::GetArgumentValue(args, CefSharpArguments::HostProcessIdArgument));
126143
if (CommandLineArgsParser::HasArgument(args, CefSharpArguments::ExitIfParentProcessClosed))
127144
{

0 commit comments

Comments
 (0)