-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
[bug] Creating two App
instances causes tao
panic on MacOS
#12934
Comments
CC @SeanPedersen, could you verify if this reproduces the issue? |
not gonna lie, this sounds like a wontfix. The If you really only need the resource dir then i'd either construct it manually or try to use https://docs.rs/tauri-utils/latest/tauri_utils/platform/fn.resource_dir.html directly. You can get PackageInfo via generate_context (which btw should also only be called once) and Env via |
If this is by design, I think it should be explicitly documented, and an explicit panic or The current behavior on Additionally, the
Just to make sure I didn't misunderstand you.🧐 Is this illegal: let ctx0 = tauri::generate_context!();
let ctx1 = tauri::generate_context!(); Or is this illegal: let ctx_builder = || tauri::generate_context!();
let ctx0 = ctx_builder();
let ctx1 = ctx_builder(); |
probably good idea
The first one is illegal and should, or used to, panic. The second one should be fine because it rust should make the macro run only once there. But with that syntax you may as well use a normal variable instead of a closure 🤷 |
Thanks for the clarification.
If I have time, I will submit a PR to
This is due to |
Describe the bug
My user reported this issue: pytauri/pytauri#99 (comment)
I suspect it's because
pytauri
instantiated twoApp
instances:Although we didn't actually use (
App::run
) the firstApp
instance and just drop it after creation, using the secondApp
instance causedtao
to panic.NOTE: This issue only occurs on MacOS, not on Linux or Windows.
Reproduction
Create the first
App
to get the resource directory, then drop it. Then create the secondApp
instance and run it.Expected behavior
Even if multiple
App
instances are created, as long asApp::run
is not called multiple times, it should not causetao
to panic.Full
tauri info
outputStack trace
Additional context
If we don't create
sample_app
, the abovetao
panic will not occur.The text was updated successfully, but these errors were encountered: