Desktop: Make shutdown more robust and fix panic caused by invalid viewport scale (#3783)

* Fix panic caused by invalid viewport scale

* Make shutdown more robust
This commit is contained in:
Timon
2026-02-22 17:28:35 +00:00
committed by GitHub
parent 9d83998463
commit a2d3b3f410
5 changed files with 26 additions and 3 deletions

View File

@@ -53,7 +53,8 @@ impl CefContext for MultiThreadedCefContextProxy {
impl Drop for MultiThreadedCefContextProxy {
fn drop(&mut self) {
cef::shutdown();
// Force dropping underlying context on the UI thread
run_on_ui_thread(move || drop(CONTEXT.take()));
}
}

View File

@@ -42,6 +42,10 @@ impl CefContext for SingleThreadedCefContext {
impl Drop for SingleThreadedCefContext {
fn drop(&mut self) {
tracing::debug!("Shutting down CEF");
// CEF wants us to close the browser before shutting down, otherwise it may run longer that necessary.
self.browser.host().unwrap().close_browser(1);
cef::shutdown();
// Sometimes some CEF processes still linger at this point and hold file handles to the cache directory.