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
Dragging selected text panics when Tauri is run from #[tokio::main]
#2838
Comments
Workaround for now to run async code: fn main() {
let data_load_result = match tokio::runtime::Runtime::new() {
Ok(runtime) => runtime.block_on(async {
// load data in separate async thread
// workaround for https://github.com/tauri-apps/tauri/issues/2838
return my_async_function(&app_paths).await;
}),
Err(e) => panic!("error creating runtime"),
};
tauri::Builder::default()
.run(tauri::generate_context!())
.expect("error while running tauri application");
} |
Possible because tauri-apps/tauri#2838 was fixed
Is this fixed? What's the recommended way of running async code in |
@orhun You can use tokio::main on the Keep in mind that the |
Describe the bug
Selecting text within the Tauri window and dragging the selection in any direction immediately results in a crash when Tauri is initialized from
#[tokio::main]
. This crash does not occur when running in a non-asyncfn main
.To Reproduce
Steps to reproduce the behavior:
yarn create tauri-app
tokio = { version = "1.13.0", features = ["full"] }
to dependencies inCargo.toml
src-tauri/src/main.rs
, replace main function with:Expected behavior
Drag and drop functions normally; the window does not crash.
Platform and Versions (required):
Tested on both Windows and Manjaro Linux; results in a crash regardless of OS.
Additional context
#[tokio::main]
is added so that some asynchronous tasks can be performed in the main function prior to initializing Tauri (e.g. reading/writing to config files, which stores results in Tauri state).Stack Trace
The text was updated successfully, but these errors were encountered: