GTK4 About dialog hangs

I have added a simple Help/About menu item to show an AboutDialog, but have experienced a very weird behavior. The first time I show the dialog it works as expected, but if I show it a second time it will not close. Being a modal dialog, this locks up the whole application.

Simple closure attached to action

let action = SimpleAction::new("help-about", None);
    action.connect_activate(clone!(@weak window => move |_action, _parameter| {
        show_help_about(&window);
    }));
    app.add_action(&action);

And the function to show is equally simple

pub fn show_help_about(window: &Window) {
    let icon = Texture::from_resource(
        "/com/shartrec/kelpie_planner/images/kelpiedog_120x120_transparent.png");
    show_about_dialog(Some(window), &[
        ("program-name", &util::info::PROGRAM_NAME),
        ("version", &util::info::VERSION),
        ("website", &util::info::WEBSITE),
        ("license-type", &util::info::LICENSE_TYPE),
        ("title", &util::info::ABOUT_TITLE),
        ("authors", &[util::info::AUTHOR].as_ref()),
        ("logo", &icon)
        ]);
}

What is that show_about_dialog function doing?

That is the standard Rust bindings for GTK4 function as documented here: show_about_dialog in gtk4 - Rust

I have discovered that this error is emitted, which I had not noticed previously

(kelpie_rust_planner:59111): Gtk-WARNING **: 13:45:42.027: A window is shown after it has been destroyed. This will leave the window in an inconsistent state.

This is a bug in that show_about_dialog function, please consider reporting it to gtk4-rs.

please consider reporting it to gtk4-rs.

Done. AboutDialog hangs application on second invocation · Issue #1544 · gtk-rs/gtk4-rs · GitHub

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.