linebender/druid · error

Dialog was deleted

Error message

Dialog was deleted

What it means

Error arm in get_file_dialog_path: the GTK FileChooserDialog was destroyed/deleted before a result could be read, so dialog.filenames() cannot be retrieved. It fires when the dialog object is dropped prematurely — e.g. the dialog was closed programmatically or its backing widget was disposed while the run loop was active.

Solutions

  1. Keep the FileChooserDialog alive until run() returns and filenames are read
  2. Avoid dropping the dialog widget from callbacks while the modal loop is running
  3. Re-open the dialog if it was disposed without a user response
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at druid-shell/src/backend/gtk/dialog.rs:101 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of linebender/druid@0f8b1195e4 (2026-09-10). Data as JSON: /api/errors/c42946673278e980. Report an issue: GitHub.

Appendix: source

Thrown at druid-shell/src/backend/gtk/dialog.rs:101

        dialog.set_current_name(default_name);
    }

    let result = dialog.run();

    let result = match result {
        ResponseType::Accept => match dialog.filenames() {
            filenames if filenames.is_empty() => Err(anyhow!("No path received for filename")),
            // If we receive more than one file, but `multi_selection` is false, return an error.
            filenames if filenames.len() > 1 && !options.multi_selection => {
                Err(anyhow!("More than one path received for single selection"))
            }
            // If we receive more than one file with a save action, return an error.
            filenames if filenames.len() > 1 && action == FileChooserAction::Save => {
                Err(anyhow!("More than one path received for save action"))
            }
            filenames => Ok(filenames.into_iter().map(|p| p.into_os_string()).collect()),
        },
        ResponseType::Cancel => Err(anyhow!("Dialog was deleted")),
        _ => {
            tracing::warn!("Unhandled dialog result: {:?}", result);
            Err(anyhow!("Unhandled dialog result"))
        }
    };

    // TODO properly handle errors into the Error type

    dialog.destroy();

    Ok(result?)
}

View on GitHub (pinned to 0f8b1195e4)