pcwalton / libui-rs

Rust bindings to the minimalist, native, cross-platform UI toolkit `libui`
Apache License 2.0
212 stars 17 forks source link

Crashes on exit [OS X] #13

Open wesleywiser opened 8 years ago

wesleywiser commented 8 years ago

Expected: Clicking the red close button on the window will cause the program to complete normally without crashing and with an exit code of 0.

Actual: Clicking the red close button results in a OS X "this app crashed" dialog and some error information printed to the console:

Running "cargo run":
   Compiling primer v0.1.0 (file:///Users/wesley/code/rust/primer)
     Running `target/debug/primer`
2016-09-21 21:48:57.313 primer[6624:5243846] [libui] darwin/alloc.m:45:uninitAlloc() You have a bug: Some data was leaked; either you left a uiControl lying around or there's a bug in libui itself. Leaked data:
0x7fd922c1c090 struct mapTable
error: Process didn't exit successfully: `target/debug/primer` (signal: 4, SIGILL: illegal instruction)

"cargo run" completed with code 101
It took approximately 9.468 seconds

Source code:

extern crate ui;

use ui::{Window, InitOptions, Label};

fn run() {
    let window = Window::new("Test", 640, 480, false);
    window.on_closing(Box::new(|_| {
        ui::quit();
        false
    }));

    window.set_child(Label::new("Hello, world!").into());

    window.show();
    ui::main();
}

fn main() {
    ui::init(InitOptions).unwrap();
    run();
    ui::uninit();
}
ghost commented 7 years ago

Also happens on both examples.