Skip to content
Snippets Groups Projects
Unverified Commit 150f0cf4 authored by GyDi's avatar GyDi Committed by GitHub
Browse files

fix: instantiate core after init app, close #122

parent 711b220a
No related branches found
No related tags found
No related merge requests found
...@@ -38,7 +38,6 @@ fn main() -> std::io::Result<()> { ...@@ -38,7 +38,6 @@ fn main() -> std::io::Result<()> {
#[allow(unused_mut)] #[allow(unused_mut)]
let mut builder = tauri::Builder::default() let mut builder = tauri::Builder::default()
.manage(core::Core::new())
.setup(|app| Ok(resolve::resolve_setup(app))) .setup(|app| Ok(resolve::resolve_setup(app)))
.system_tray(SystemTray::new().with_menu(tray_menu)) .system_tray(SystemTray::new().with_menu(tray_menu))
.on_system_tray_event(move |app_handle, event| match event { .on_system_tray_event(move |app_handle, event| match event {
......
...@@ -9,12 +9,16 @@ pub fn resolve_setup(app: &App) { ...@@ -9,12 +9,16 @@ pub fn resolve_setup(app: &App) {
// init app config // init app config
init::init_app(app.package_info()); init::init_app(app.package_info());
// init states // init core
let core = app.state::<Core>(); // should be initialized after init_app fix #122
let core = Core::new();
core.set_win(app.get_window("main")); core.set_win(app.get_window("main"));
core.init(app.app_handle()); core.init(app.app_handle());
// fix #122
app.manage(core);
resolve_window(app); resolve_window(app);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment