-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: introduce App::run_return
#12668
base: dev
Are you sure you want to change the base?
feat: introduce App::run_return
#12668
Conversation
Package Changes Through 71c51eaThere are 8 changes which include tauri-cli with minor, tauri-runtime with minor, tauri-runtime-wry with minor, tauri-utils with minor, tauri with minor, @tauri-apps/api with minor, @tauri-apps/cli with minor, tauri-bundler with patch Planned Package VersionsThe following package releases are the planned based on the context of changes in this pull request.
Add another change file through the GitHub UI by following this link. Read about change files or the docs at github.com/jbolda/covector |
Do we want to deprecate |
5b41a90
to
e48e8c3
Compare
crates/tauri-runtime-wry/src/lib.rs
Outdated
@@ -2840,13 +2843,13 @@ impl<T: UserEvent> Runtime<T> for Wry<T> { | |||
let active_tracing_spans = self.context.main_thread.active_tracing_spans.clone(); | |||
let proxy = self.event_loop.create_proxy(); | |||
|
|||
self.event_loop.run(move |event, event_loop, control_flow| { | |||
self.event_loop.run_return(move |e, event_loop, cf| { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I renamed these variables here so that this stays on one line. That way, the git diff shows nicely that run_return
is effectively what run
used to be.
pub fn run_return<F: FnMut(&AppHandle<R>, RunEvent) + 'static>( | ||
mut self, | ||
mut callback: F, | ||
) -> std::result::Result<i32, Box<dyn std::error::Error>> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've just used the same error as from the setup callback. It is missing Send + Sync + 'static
bounds unfortunately but that is already the case and can't be changed now I think.
imo yes |
iirc run_return also works on android (though probably good to test that first), only iOS should be a problem. I'm wondering whether we should really go for the cfg flag you used or just try to do what winit for example does and just document that it doesn't return ever on iOS (using tao's run instead of run_return for iOS internally). didn't look too much into the code yet so idk how feasible that is. |
Removing the cfg is a semver-compatible change so we can always do that later? I'd prefer an incremental approach if possible! :)
Deciding on what the mobile story is here seems like a different problem to me that I'd rather not tackle, also because I don't know the internals of tao and Tauri well enough :) |
|
The current
App::run_iteration
function is buggy because it busy-loops. To address the use-case of cleaning up resources in the host program, we introduceApp::run_return
which builds on top oftao
'sEventloop::run_return
.Related: #8631.