Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
e32558a
Update gir-files
sdroege Aug 9, 2025
ad2e3a8
Regenerate with latest gir-files
sdroege Aug 9, 2025
bee0cd4
Impl AsFd for FileDescriptorBased
swsnr Jul 16, 2025
eb84826
glib: Don't drop `T` if `ThreadGuard<T>` is dropped on the wrong thread.
zachs18 Jul 17, 2025
e15ec18
glib: Don't double-panic if `ThreadGuard::into_inner` is called on th…
zachs18 Jul 17, 2025
f3586cd
gio: Fix segfault in ListStore::find_with_equal_func
pjungkamp Jul 22, 2025
93ea089
build(deps): bump criterion from 0.6.0 to 0.7.0
dependabot[bot] Aug 4, 2025
fcfc989
cairo: Fix return type for cairo_script_create_for_stream.
inklesspen Jul 29, 2025
1a6b5c7
glib: Fix new clippy warnings
sdroege Aug 5, 2025
582ea49
glib: Only build regex compiletests if the corresponding feature is e…
sdroege Aug 6, 2025
46d776e
cairo: write-to-stream callbacks should accept const pointers to data
inklesspen Aug 5, 2025
19322b3
glib: Fix segfault in `List::retain()`
sdroege Aug 6, 2025
ee1941b
glib: Fix overflow in `StrV::reserve` when checking capacity
kawadakk Aug 7, 2025
15f39c3
glib: Fix overflow in `StrV::extend_from_slice` when checking capacity
kawadakk Aug 7, 2025
488fd34
glib: Null-terminate on every iteration in `StrV::extend_from_slice`
kawadakk Aug 8, 2025
1078303
glib: Compare lengths in `<StrVRef as PartialEq<[&str]>>::eq`
kawadakk Aug 7, 2025
b5c9fb5
glib: Compare lengths in `<StrV as PartialEq<[&str]>>::eq` too
sdroege Aug 9, 2025
4a72970
glib: Null-terminate on every iteration in `PtrSlice::extend_from_slice`
sdroege Aug 9, 2025
e6af412
glib: Avoid more integer overflows when reserving space in `PtrSlice`…
sdroege Aug 9, 2025
68caffb
Update Cargo.lock
sdroege Aug 9, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 39 additions & 41 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion cairo/src/stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ struct MutableCallbackEnvironment {
// so code outside of the `catch_unwind` call must never panic.
extern "C" fn write_callback<W: io::Write + 'static>(
env: *mut c_void,
data: *mut c_uchar,
data: *const c_uchar,
length: c_uint,
) -> ffi::cairo_status_t {
// This is consistent with the type of `env` in `Surface::_for_stream`.
Expand Down
2 changes: 1 addition & 1 deletion cairo/src/surface_png.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ struct WriteEnv<'a, W: 'a + Write> {

unsafe extern "C" fn write_func<W: Write>(
closure: *mut c_void,
data: *mut u8,
data: *const u8,
len: c_uint,
) -> crate::ffi::cairo_status_t {
let write_env: &mut WriteEnv<W> = &mut *(closure as *mut WriteEnv<W>);
Expand Down
4 changes: 2 additions & 2 deletions cairo/sys/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ pub type cairo_destroy_func_t = Option<unsafe extern "C" fn(*mut c_void)>;
pub type cairo_read_func_t =
Option<unsafe extern "C" fn(*mut c_void, *mut c_uchar, c_uint) -> cairo_status_t>;
pub type cairo_write_func_t =
Option<unsafe extern "C" fn(*mut c_void, *mut c_uchar, c_uint) -> cairo_status_t>;
Option<unsafe extern "C" fn(*mut c_void, *const c_uchar, c_uint) -> cairo_status_t>;

#[cfg(feature = "freetype")]
#[cfg_attr(docsrs, doc(cfg(feature = "freetype")))]
Expand Down Expand Up @@ -1523,7 +1523,7 @@ extern "C" {
pub fn cairo_script_create_for_stream(
write_func: cairo_write_func_t,
closure: *mut c_void,
) -> cairo_status_t;
) -> *mut cairo_device_t;
#[cfg(feature = "script")]
#[cfg_attr(docsrs, doc(cfg(feature = "script")))]
pub fn cairo_script_from_recording_surface(
Expand Down
2 changes: 1 addition & 1 deletion gdk-pixbuf/src/auto/versions.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Generated by gir (https://github.com/gtk-rs/gir @ 19ccbbc9a3d1)
from gir-files (https://github.com/gtk-rs/gir-files @ 5c1e490fe50a)
from gir-files (https://github.com/gtk-rs/gir-files @ a79d23cd6a42)
2 changes: 1 addition & 1 deletion gdk-pixbuf/sys/versions.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Generated by gir (https://github.com/gtk-rs/gir @ 19ccbbc9a3d1)
from gir-files (https://github.com/gtk-rs/gir-files @ 5c1e490fe50a)
from gir-files (https://github.com/gtk-rs/gir-files @ a79d23cd6a42)
2 changes: 1 addition & 1 deletion gio/src/auto/versions.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Generated by gir (https://github.com/gtk-rs/gir @ 19ccbbc9a3d1)
from gir-files (https://github.com/gtk-rs/gir-files @ 5c1e490fe50a)
from gir-files (https://github.com/gtk-rs/gir-files @ a79d23cd6a42)
10 changes: 8 additions & 2 deletions gio/src/file_descriptor_based.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// Take a look at the license at the top of the repository in the LICENSE file.

#[cfg(unix)]
use std::os::unix::io::{AsRawFd, FromRawFd, RawFd};
use std::os::unix::io::{AsFd, AsRawFd, BorrowedFd, FromRawFd, RawFd};

use crate::ffi;
use glib::{prelude::*, translate::*};
#[cfg(all(not(unix), docsrs))]
use socket::{AsRawFd, FromRawFd, IntoRawFd, RawFd};
use socket::{AsFd, AsRawFd, BorrowedFd, FromRawFd, IntoRawFd, RawFd};

glib::wrapper! {
#[doc(alias = "GFileDescriptorBased")]
Expand All @@ -27,6 +27,12 @@ impl AsRawFd for FileDescriptorBased {
}
}

impl AsFd for FileDescriptorBased {
fn as_fd(&self) -> BorrowedFd<'_> {
unsafe { BorrowedFd::borrow_raw(self.as_raw_fd()) }
}
}

pub trait FileDescriptorBasedExtManual: IsA<FileDescriptorBased> + 'static {
#[doc(alias = "g_file_descriptor_based_get_fd")]
#[doc(alias = "get_fd")]
Expand Down
53 changes: 36 additions & 17 deletions gio/src/list_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,34 +150,53 @@ impl ListStore {
(*func)(&a).into_glib()
}

unsafe {
// GIO requires a non-NULL item to be passed in so we're constructing a fake item here.
// See https://gitlab.gnome.org/GNOME/glib/-/merge_requests/3284
let mut func = equal_func;
let func_obj: &mut (dyn FnMut(&Object) -> bool) = &mut func;
let func_ptr = &func_obj as *const &mut (dyn FnMut(&Object) -> bool) as glib::ffi::gpointer;
let mut position = std::mem::MaybeUninit::uninit();

// GIO prior to 2.76 requires a non-NULL item to be passed in so we're constructing a fake item here.
// See https://gitlab.gnome.org/GNOME/glib/-/merge_requests/3284
#[cfg(not(feature = "v2_76"))]
let result = unsafe {
let g_class: *mut glib::gobject_ffi::GTypeClass =
glib::gobject_ffi::g_type_class_peek(self.item_type().into_glib()) as *mut _;

// g_class will be `NULL` when no instance of the `item-type` has been created yet.
// See https://github.com/gtk-rs/gtk-rs-core/issues/1767
if g_class.is_null() {
return None;
}

let item = glib::gobject_ffi::GObject {
g_type_instance: glib::gobject_ffi::GTypeInstance {
g_class: glib::gobject_ffi::g_type_class_peek(self.item_type().into_glib())
as *mut _,
},
g_type_instance: glib::gobject_ffi::GTypeInstance { g_class },
ref_count: 1,
qdata: std::ptr::null_mut(),
};
let mut func = equal_func;
let func_obj: &mut (dyn FnMut(&Object) -> bool) = &mut func;
let func_ptr =
&func_obj as *const &mut (dyn FnMut(&Object) -> bool) as glib::ffi::gpointer;

let mut position = std::mem::MaybeUninit::uninit();

let found = bool::from_glib(ffi::g_list_store_find_with_equal_func_full(
bool::from_glib(ffi::g_list_store_find_with_equal_func_full(
self.to_glib_none().0,
mut_override(&item as *const _),
Some(equal_func_trampoline),
func_ptr,
position.as_mut_ptr(),
));
))
.then(|| position.assume_init())
};

found.then(|| position.assume_init())
}
#[cfg(feature = "v2_76")]
let result = unsafe {
bool::from_glib(ffi::g_list_store_find_with_equal_func_full(
self.to_glib_none().0,
std::ptr::null_mut(),
Some(equal_func_trampoline),
func_ptr,
position.as_mut_ptr(),
))
.then(|| position.assume_init())
};

result
}
}

Expand Down
2 changes: 1 addition & 1 deletion gio/sys/versions.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Generated by gir (https://github.com/gtk-rs/gir @ 19ccbbc9a3d1)
from gir-files (https://github.com/gtk-rs/gir-files @ 5c1e490fe50a)
from gir-files (https://github.com/gtk-rs/gir-files @ a79d23cd6a42)
2 changes: 1 addition & 1 deletion gir-files
Submodule gir-files updated 7 files
+12 −7 GLib-2.0.gir
+5 −1 GModule-2.0.gir
+180 −8 Gdk-4.0.gir
+11 −2 Gio-2.0.gir
+298 −2 Gsk-4.0.gir
+296 −22 Gtk-4.0.gir
+231 −48 HarfBuzz-0.0.gir
6 changes: 5 additions & 1 deletion glib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ memchr = "2.7.5"
tempfile = "3"
gir-format-check.workspace = true
trybuild2 = "1"
criterion = "0.6.0"
criterion = "0.7.0"

[features]
default = ["gio"]
Expand Down Expand Up @@ -64,6 +64,10 @@ gio = ["gio-sys"]
name = "subclass_compiletest"
required-features = ["compiletests"]

[[test]]
name = "regex_compiletest"
required-features = ["compiletests"]

[[bench]]
name = "gstring"
harness = false
Expand Down
Loading
Loading