-
-
Notifications
You must be signed in to change notification settings - Fork 131
Closed
Description
Hi,
i have this inside a app.connect_command_line
:
let stdin = cmd.stdin();
let data_stream = gio::DataInputStream::new(&stdin.unwrap());
let data_stream_rc = Rc::new(data_stream);
fn read_line_callback(
stream: Rc<gio::DataInputStream>,
i: i32,
items: gio::ListStore,
) {
let stream_clone = Rc::clone(&stream);
stream.read_line_async(
Priority::DEFAULT,
Cancellable::NONE,
move |line_slice| match line_slice {
Ok(line_slice) => {
if line_slice.is_empty() {
return;
}
if let Ok(line_str) = std::str::from_utf8(&line_slice) {
// irrelevant
}
read_line_callback(
Rc::clone(&stream_clone),
i + 1,
items.clone(),
);
}
Err(e) => {
eprintln!("Error reading: {}", e);
return;
}
},
);
}
read_line_callback(Rc::clone(&data_stream_rc), 0, items.clone());
The problem is that when there's data on stdin
, it always runs into this error:
thread 'main' panicked at /home/andrej/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/glib-0.20.12/src/collections/slice.rs:511:9:
assertion failed: !ptr.is_null() || len == 0
I have no idea why...
gtk4 = { version = "^0.9.7", features = ["v4_6", "v4_12", "gio_v2_80"] }
Anyone has a clue what i'm missing? Or is this a bug?
Metadata
Metadata
Assignees
Labels
No labels