Skip to content

Commit cb11b50

Browse files
committed
Fix gio::FileEnumeratorExt::close(): return value does not indicate success or error
Signed-off-by: fbrouille <[email protected]>
1 parent 611dc0d commit cb11b50

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

gio/Gir.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -891,6 +891,12 @@ manual_traits = ["FileEnumeratorExtManual"]
891891
name = "iterate"
892892
# better with rust iterators
893893
ignore = true
894+
[[object.function]]
895+
name = "close"
896+
[object.function.return]
897+
# Return value does not indicate success or error: despite the documentation, this function could return TRUE and an error in same time.
898+
# see https://gitlab.gnome.org/GNOME/glib/-/blob/dc6f9447cd2a01012731422afed6facff1eea81a/gio/gfileenumerator.c#L290-297
899+
use_return_for_result = true
894900

895901
[[object]]
896902
name = "Gio.FileInfo"

gio/src/auto/file_enumerator.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,16 @@ impl FileEnumerator {
2121

2222
pub trait FileEnumeratorExt: IsA<FileEnumerator> + 'static {
2323
#[doc(alias = "g_file_enumerator_close")]
24-
fn close(&self, cancellable: Option<&impl IsA<Cancellable>>) -> Result<(), glib::Error> {
24+
fn close(&self, cancellable: Option<&impl IsA<Cancellable>>) -> Result<bool, glib::Error> {
2525
unsafe {
2626
let mut error = std::ptr::null_mut();
27-
let is_ok = ffi::g_file_enumerator_close(
27+
let ret = ffi::g_file_enumerator_close(
2828
self.as_ref().to_glib_none().0,
2929
cancellable.map(|p| p.as_ref()).to_glib_none().0,
3030
&mut error,
3131
);
32-
debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
3332
if error.is_null() {
34-
Ok(())
33+
Ok(from_glib(ret))
3534
} else {
3635
Err(from_glib_full(error))
3736
}

0 commit comments

Comments
 (0)