From 71a190dfe662fe4713cfbd11001d26775406bf6b Mon Sep 17 00:00:00 2001 From: amaitland Date: Mon, 4 May 2020 11:34:52 +1000 Subject: [PATCH] OffScreen Example - Demo Cef.WaitForBrowsersToClose(); Issue #3047 --- CefSharp.OffScreen.Example/Program.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CefSharp.OffScreen.Example/Program.cs b/CefSharp.OffScreen.Example/Program.cs index 79e188aec..b44952f44 100644 --- a/CefSharp.OffScreen.Example/Program.cs +++ b/CefSharp.OffScreen.Example/Program.cs @@ -22,6 +22,8 @@ namespace CefSharp.OffScreen.Example Console.WriteLine("You may see a lot of Chromium debugging output, please wait..."); Console.WriteLine(); + Cef.EnableWaitForBrowsersToClose(); + // You need to replace this with your own call to Cef.Initialize(); CefExample.Init(new CefSettings(), browserProcessHandler: new BrowserProcessHandler()); @@ -34,6 +36,11 @@ namespace CefSharp.OffScreen.Example // We have to wait for something, otherwise the process will exit too soon. Console.ReadKey(); + //Wait until the browser has finished closing (which by default happens on a different thread). + //Cef.EnableWaitForBrowsersToClose(); must be called before Cef.Initialize to enable this feature + //See https://github.com/cefsharp/CefSharp/issues/3047 for details + Cef.WaitForBrowsersToClose(); + // Clean up Chromium objects. You need to call this in your application otherwise // you will get a crash when closing. Cef.Shutdown();