gtk-rs / gtk3-rs

Rust bindings for GTK 3
https://gtk-rs.org
MIT License
508 stars 90 forks source link

[HELP] STATUS_ACCESS_VIOLATION when right clicking an Entry widget #822

Closed DoubleCouponDay closed 1 year ago

DoubleCouponDay commented 1 year ago

I am using the gtk cargo package version 0.17.1 to build a desktop application for windows. My Installed GTK version is 3.24.37. I use an Entry widget in my window and, when debugging, I attempt to click the widget 3 times. Sometimes it will freeze after the first right click, the right click menu will not popup and the program will crash with the following error:

process didn't exit successfully: ... (exit code: 0xc0000005, STATUS_ACCESS_VIOLATION)

Sometimes this occurs after 3 right clicks. I am also experiencing the same crash and variable frequency upon trying to paste UTF-8 text into the Entry.

    let groupname_box = SearchEntry::builder()
        .placeholder_text(GROUP_PLACEHOLDER)
        .width_request(windows::WIDTH)
        .build();

    let scroll_window = ScrolledWindow::builder()
        .width_request(WIDTH)
        .height_request(HEIGHT)
        .hscrollbar_policy(PolicyType::Never)
        .vscrollbar_policy(PolicyType::Automatic)
        .child(&defaultsbox)
        .build();

    let view = GtkBox::builder()
        .orientation(Orientation::Horizontal)
        .child(&button_box)
        .child(&scroll_window)
        .build();

    groupname_box.connect_paste_clipboard(move |box_context| {
        log("token box pasted");
    });

    groupname_box.connect_button_release_event(move |_, _| {
        Inhibit(false)
    });

Please advise the best way to fix this behaviour. Is this a bug that was fixed in GTK4? Am I handling user input events badly? Something else?

sdroege commented 1 year ago

Can you provide a complete, compile'able application? Also did you compile GTK yourself or where did you get it from?

DoubleCouponDay commented 1 year ago

the GTK distribution came from pacman's mingw-w64-x86_64-gtk3 package. I have been advised that this bug is related this issue. Having upgraded to gtk4, the bug no longer appears when right clicking or using CTRL + V.

sdroege commented 1 year ago

Thanks for the update!