Set the stack size of the main thread to 8M (#227)

For fix stack overflow issue on Windows.
This commit is contained in:
Sunli 2024-09-09 10:24:41 +08:00 committed by GitHub
parent 821487bed5
commit 2f80ba408a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,4 +1,4 @@
use std::sync::Arc;
use std::{sync::Arc, thread};
use anyhow::Result;
use app_state::AppState;
@ -21,6 +21,9 @@ fn init(app_state: Arc<AppState>, cx: &mut AppContext) -> Result<()> {
}
fn main() {
let join_handle = thread::Builder::new()
.stack_size(8 * 1024 * 1024) // Set the stack size to 8MB
.spawn(|| {
let app_state = Arc::new(AppState {});
let app = App::new().with_assets(Assets);
@ -59,6 +62,9 @@ fn main() {
})
.detach();
});
})
.unwrap();
join_handle.join().unwrap();
}
fn quit(_: &Quit, cx: &mut AppContext) {