Search code examples
windowsrustgtkgtk3

STATUS_ACCESS_VIOLATION when right clicking an Entry widget


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?


Solution

  • Related to known bug types in GTK3. I have upgraded to GTK4 which has fixed all these crashes.