mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-19 19:08:05 +08:00
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:
@@ -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()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user