jdm / tinyfiledialogs-rs

A Rust binding for the tinyfiledialogs library.
http://sourceforge.net/projects/tinyfiledialogs/
55 stars 22 forks source link

color_chooser_dialog segfaults if no color is picked #32

Closed fschutt closed 2 years ago

fschutt commented 3 years ago
fn main() {
    let result = color_chooser_dialog("test", [0, 0, 0]);
    println!("color: {}", result);
}

If you select "cancel", the exe will segfault - tinyfiledialogs returns a nullptr on failure, maybe that's the reason.

jdm commented 2 years ago

This library actually handles null return values, so it's something else. What platform did you observe this on?

fschutt commented 2 years ago

Windows. See my commit: https://github.com/fschutt/azul/commit/ae3100141aa68bfdf03f938d25f93e1bd03ccbd3

macpp commented 2 years ago

I can reproduce this with c liblary v3.8.3, but not v3.8.8 . In new version, some additional null check is present here https://github.com/jdm/tinyfiledialogs-rs/blob/3d997f5d9bad92fe55ef18caf18e5712282ea717/libtinyfiledialogs/tinyfiledialogs.c#L3169-L3173 And adding it back to older version also seems to fix issue, at least for me. So, maybe this issue can already be closed?