Skip to content
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

[Tauri] App crashes when using the js api #23

Open
skyslide22 opened this issue Jan 5, 2024 · 8 comments
Open

[Tauri] App crashes when using the js api #23

skyslide22 opened this issue Jan 5, 2024 · 8 comments

Comments

@skyslide22
Copy link

skyslide22 commented Jan 5, 2024

I am on macos, the tauri v1 app crashes as soon as i call startDrag.

    import { startDrag } from "@crabnebula/tauri-plugin-drag";

    async onmousedown()
    {
        const item = this.action.options.dropped_paths[0]; // example: /Users/skyslide/Desktop/favicon.png (32x32)
        if(!item) return;
        
        startDrag({item: [item], icon: null}) // or icon = item
    }

When i don't pass the icon key at all it doesn't crash, but no drag either.
The file definitly exist and the app has access to /Desktop.

There is no message in the terminal when the app closes...

npm run tauri info output:

[] Environment
    - OS: Mac OS 14.1.2 X64
    ✔ Xcode Command Line Tools: installed
    ✔ rustc: 1.74.0 (79e9716c9 2023-11-13)
    ✔ cargo: 1.74.0 (ecb9851af 2023-10-18)
    ✔ rustup: 1.26.0 (5af9b9484 2023-04-05)
    ✔ Rust toolchain: stable-x86_64-apple-darwin (default)
    - node: 21.2.0
    - pnpm: 8.14.0
    - yarn: 1.22.21
    - npm: 10.2.3

[-] Packages
    - tauri [RUST]: 1.5.3
    - tauri-build [RUST]: 1.5.0
    - wry [RUST]: 0.24.6
    - tao [RUST]: 0.16.5
    - tauri-cli [RUST]: 1.5.7
    - @tauri-apps/api [NPM]: 1.5.1 (outdated, latest: 1.5.3)
    - @tauri-apps/cli [NPM]: 1.5.7 (outdated, latest: 1.5.9)

[-] App
    - build-type: bundle
    - CSP: default-src 'self' https://*.fontawesome.com https://kit.fontawesome.com 'unsafe-inline'; style-src 'self' https://*.fontawesome.com https://kit.fontawesome.com 'unsafe-inline'; script-src 'self' 'unsafe-inline' ; img-src 'self' asset: https://asset.localhost
    - distDir: ../dist
    - devPath: http://localhost:8080/
    - framework: Svelte
    - bundler: Vite

main.rs:

#![cfg_attr(
    all(not(debug_assertions), target_os = "windows"),
    windows_subsystem = "windows"
)]

use tauri::{Manager, WindowBuilder};

mod commands;
mod device_listener;

fn main() {
    tauri::Builder::default()
        .plugin(tauri_plugin_drag::init())
        .setup(|app| {
            let handle = app.handle();
            crate::device_listener::create_device_query_listener(handle);
            let window = app.get_window("main").unwrap();

            Ok(())
        })
        .invoke_handler(tauri::generate_handler![
            crate::commands::console_log,
            // and more
        ])
        .run(tauri::generate_context!())
        .expect("error while running tauri application");
}

I have also tested your example at https://github.com/crabnebula-dev/drag-rs/blob/main/examples/tauri/index.html and it crashes the app aswell

@vincehi
Copy link

vincehi commented Jun 17, 2024

I have the same problem

@vincehi
Copy link

vincehi commented Jun 24, 2024

@skyslide22 Have you found a solution?

@skyslide22
Copy link
Author

@skyslide22 Have you found a solution?

no, i have not touched this crate/rust in general since

@vincehi
Copy link

vincehi commented Jun 26, 2024

Enregistrement.de.l.ecran.2024-06-26.a.11.03.40.mov
2024-06-26 11:03:43.278 tauri-app[6272:46699] -[__NSTaggedDate _nsib_usesPointIntegralizationForLayout]: unrecognized selector sent to instance 0x617274736e6f4373
thread 'main' panicked at /Users/USER/Sites/perso2024/drag-rs/crates/drag/src/platform_impl/macos/mod.rs:67:45:
Uncaught exception <NSException: 0x7fd2e87e48a0>
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread 'tokio-runtime-worker' panicked at /Users/USER/Sites/perso2024/drag-rs/crates/tauri-plugin-drag/src/lib.rs:146:15:
called `Result::unwrap()` on an `Err` value: RecvError

npm run tauri info :

[✔] Environment
    - OS: Mac OS 12.7.4 X64
    ✔ Xcode Command Line Tools: installed
    ✔ rustc: 1.78.0 (9b00956e5 2024-04-29)
    ✔ cargo: 1.78.0 (54d8815d0 2024-03-26)
    ✔ rustup: 1.27.1 (54dd3d00f 2024-04-24)
    ✔ Rust toolchain: stable-x86_64-apple-darwin (default)
    - node: 20.11.0
    - pnpm: 7.13.4
    - yarn: 1.22.19
    - npm: 10.8.1
    - bun: 1.1.12

[-] Packages
    - tauri [RUST]: 1.6.8
    - tauri-build [RUST]: 1.5.2
    - wry [RUST]: 0.24.10
    - tao [RUST]: 0.16.2
    - cargo-tauri [RUST]: 1.0.0
    - @tauri-apps/api [NPM]: 1.5.6
    - @tauri-apps/cli [NPM]: 1.5.6 (outdated, latest: 1.5.14)

[-] App
    - build-type: bundle
    - CSP: default-src 'self' asset: https://asset.localhost; img-src 'self'; media-src 'self'
    - distDir: ../dist
    - devPath: http://localhost:5173/
    - framework: SolidJS
    - bundler: Vite
    ```

@vincehi
Copy link

vincehi commented Jul 22, 2024

Is this plugin being maintained or has it been discontinued?

@ayangweb
Copy link
Contributor

My computer works fine!

iShot_2024-10-16_10.58.25.mp4

@lucasfernog-crabnebula
Copy link
Member

looks like it's crashing on this

let current_position: NSPoint = msg_send![ns_view, backingAlignedRect: NSRect::new(mouse_location, NSSize::new(0., 0.)) options: NSAlignmentOptions::NSAlignAllEdgesOutward];
i cannot reproduce it unfortunately ;/

@atdyer
Copy link

atdyer commented Nov 29, 2024

I'm seeing a hard crash as well, both in my own project and in the repo's examples. In case it's helpful, here is the stack trace produced when trying to drag in the tauri-app-dragout example.

OS: MacOS 14.6.1
Processor: Intel Core i7

Crashed Thread:        0  main  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_BAD_ACCESS (SIGSEGV)
Exception Codes:       UNKNOWN_0xD at 0x0000000000000000
Exception Codes:       0x000000000000000d, 0x0000000000000000

Termination Reason:    Namespace SIGNAL, Code 11 Segmentation fault: 11
Terminating Process:   exc handler [70564]

VM Region Info: 0 is not in any region.  Bytes before following region: 4535619584
      REGION TYPE                    START - END         [ VSIZE] PRT/MAX SHRMOD  REGION DETAIL
      UNUSED SPACE AT START
--->  
      __TEXT                      10e581000-10f71b000    [ 17.6M] r-x/r-x SM=COW  /Users/USER/*/tauri-app-dragout

Kernel Triage:
VM - (arg = 0x3) mach_vm_allocate_kernel failed within call to vm_map_enter


Thread 0 Crashed:: main Dispatch queue: com.apple.main-thread
0   libobjc.A.dylib               	    0x7ff815320197 objc_msgSend + 23
1   AppKit                        	    0x7ff819a34568 NSViewGetTransformToBacking + 46
2   AppKit                        	    0x7ff819a33e9d NSViewAlignRect + 58
3   AppKit                        	    0x7ff818e6934d -[NSView backingAlignedRect:options:] + 39
4   tauri-app-dragout             	       0x10e7543a5 _$LT$$LP$A$C$B$RP$$u20$as$u20$objc..message..MessageArguments$GT$::invoke::haaaca82769c46761 + 245
5   tauri-app-dragout             	       0x10ee1d939 objc::message::platform::send_unverified::h9b7c45f3bf3f5d1e + 201
6   tauri-app-dragout             	       0x10e5f4697 drag::platform_impl::platform::start_drag::hc8f4812896d8c026 + 2823
7   tauri-app-dragout             	       0x10e758c94 tauri_plugin_drag_as_window::commands::perform_drag::_$u7b$$u7b$closure$u7d$$u7d$::h66fd88d4bfc2b150 + 916
8   tauri-app-dragout             	       0x10e6b18c1 core::ops::function::FnOnce::call_once$u7b$$u7b$vtable.shim$u7d$$u7d$::hd02e689f5d01821b + 17
9   tauri-app-dragout             	       0x10eeb89f5 _$LT$alloc..boxed..Box$LT$F$C$A$GT$$u20$as$u20$core..ops..function..FnOnce$LT$Args$GT$$GT$::call_once::h1bd57569a4d54b86 + 53
10  tauri-app-dragout             	       0x10eeeffe4 tauri_runtime_wry::handle_user_message::h509805fc75cdf272 + 708
11  tauri-app-dragout             	       0x10edefb9b tauri_runtime_wry::handle_event_loop::hf6d63d207997a79a + 10155
12  tauri-app-dragout             	       0x10edf2695 _$LT$tauri_runtime_wry..Wry$LT$T$GT$$u20$as$u20$tauri_runtime..Runtime$LT$T$GT$$GT$::run::_$u7b$$u7b$closure$u7d$$u7d$::h9dd19cd70f9196e2 + 933
13  tauri-app-dragout             	       0x10e8a1bd3 _$LT$tao..platform_impl..platform..app_state..EventLoopHandler$LT$T$GT$$u20$as$u20$tao..platform_impl..platform..app_state..EventHandler$GT$::handle_user_events::_$u7b$$u7b$closure$u7d$$u7d$::h965cdc635f35deb1 + 1043
14  tauri-app-dragout             	       0x10e8a2448 tao::platform_impl::platform::app_state::EventLoopHandler$LT$T$GT$::with_callback::h813ecb936cbf9327 + 472
15  tauri-app-dragout             	       0x10e8a17b5 _$LT$tao..platform_impl..platform..app_state..EventLoopHandler$LT$T$GT$$u20$as$u20$tao..platform_impl..platform..app_state..EventHandler$GT$::handle_user_events::h4594dd1c1980819b + 21
16  tauri-app-dragout             	       0x10f01fac2 tao::platform_impl::platform::app_state::Handler::handle_user_events::h5b6dbd7cde5201cc + 642
17  tauri-app-dragout             	       0x10f0212c4 tao::platform_impl::platform::app_state::AppState::cleared::h2aba39430056f105 + 452
18  tauri-app-dragout             	       0x10efe6260 tao::platform_impl::platform::observer::control_flow_end_handler::_$u7b$$u7b$closure$u7d$$u7d$::h9223be3d743a43d3 + 96
19  tauri-app-dragout             	       0x10efe60e0 tao::platform_impl::platform::observer::control_flow_handler::_$u7b$$u7b$closure$u7d$$u7d$::h9f2e8ca2d2e2d610 + 32
20  tauri-app-dragout             	       0x10efd40df std::panicking::try::do_call::hd4795a65fe200e93 + 47
21  tauri-app-dragout             	       0x10efdbc6d __rust_try + 29
22  tauri-app-dragout             	       0x10efd4037 std::panicking::try::he7a58a230b81355d + 55
23  tauri-app-dragout             	       0x10f024df5 std::panic::catch_unwind::h264d5354bd67e5da + 21
24  tauri-app-dragout             	       0x10f02361e tao::platform_impl::platform::event_loop::stop_app_on_panic::h9b47b5e89966b658 + 78
25  tauri-app-dragout             	       0x10efe6049 tao::platform_impl::platform::observer::control_flow_handler::ha55c2323dbd3bdb4 + 233
26  tauri-app-dragout             	       0x10efe61f8 tao::platform_impl::platform::observer::control_flow_end_handler::h3ceb9b9a199b40ba + 40
27  CoreFoundation                	    0x7ff8157ca586 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
28  CoreFoundation                	    0x7ff8157ca4aa __CFRunLoopDoObservers + 493
29  CoreFoundation                	    0x7ff8157c9b60 __CFRunLoopRun + 1158
30  CoreFoundation                	    0x7ff8157c9112 CFRunLoopRunSpecific + 557
31  HIToolbox                     	    0x7ff8201e8a09 RunCurrentEventLoopInMode + 292
32  HIToolbox                     	    0x7ff8201e8816 ReceiveNextEventCommon + 665
33  HIToolbox                     	    0x7ff8201e8561 _BlockUntilNextEventMatchingListInModeWithFilter + 66
34  AppKit                        	    0x7ff818e39171 _DPSNextEvent + 880
35  AppKit                        	    0x7ff81974daf0 -[NSApplication(NSEventRouting) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 1273
36  AppKit                        	    0x7ff818e2a585 -[NSApplication run] + 603
37  tauri-app-dragout             	       0x10f0511a1 _$LT$$LP$$RP$$u20$as$u20$objc..message..MessageArguments$GT$::invoke::h21aacb137be628cb + 65
38  tauri-app-dragout             	       0x10f050f0d objc::message::platform::send_unverified::hf345533c1d12e28e + 125
39  tauri-app-dragout             	       0x10e69d888 tao::platform_impl::platform::event_loop::EventLoop$LT$T$GT$::run_return::h383c6719b6962e38 + 1224
40  tauri-app-dragout             	       0x10e69e791 tao::platform_impl::platform::event_loop::EventLoop$LT$T$GT$::run::h00bccbb7895e75a9 + 17
41  tauri-app-dragout             	       0x10edf92e8 tao::event_loop::EventLoop$LT$T$GT$::run::h3329c8bbc6d9b5c1 + 56
42  tauri-app-dragout             	       0x10edf21ab _$LT$tauri_runtime_wry..Wry$LT$T$GT$$u20$as$u20$tauri_runtime..Runtime$LT$T$GT$$GT$::run::h604892a98e482d06 + 571
43  tauri-app-dragout             	       0x10e83d99a tauri::app::App$LT$R$GT$::run::h63fe7f52291cc5c3 + 394
44  tauri-app-dragout             	       0x10e83e375 tauri::app::Builder$LT$R$GT$::run::h791b7203b832c523 + 117
45  tauri-app-dragout             	       0x10e8352c6 tauri_plugin_drag_as_window_lib::run::haa5f7d6f216735dc + 614
46  tauri-app-dragout             	       0x10e582109 tauri_app_dragout::main::h1e34bebb6140e35a + 9 (main.rs:5)
47  tauri-app-dragout             	       0x10e58223e core::ops::function::FnOnce::call_once::hd918db44f6c15e56 + 14 (function.rs:250)
48  tauri-app-dragout             	       0x10e5821c1 std::sys_common::backtrace::__rust_begin_short_backtrace::h213c5e18db606eff + 17 (backtrace.rs:155)
49  tauri-app-dragout             	       0x10e582194 std::rt::lang_start::_$u7b$$u7b$closure$u7d$$u7d$::h5a7258a1a0788250 + 20 (rt.rs:159)
50  tauri-app-dragout             	       0x10f391337 std::rt::lang_start_internal::h0c6931bcd088f2f1 + 743
51  tauri-app-dragout             	       0x10e582167 std::rt::lang_start::h52cb48204ba26bc9 + 55 (rt.rs:158)
52  tauri-app-dragout             	       0x10e582128 main + 24
53  dyld                          	    0x7ff815362345 start + 1909

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants