Skip to content

Commit a2c8bba

Browse files
committed
glib: Return a reference to the ValueArray pspec element spec
Less refcounting.
1 parent 254693c commit a2c8bba

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

glib/src/param_spec.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1462,11 +1462,18 @@ impl ParamSpecValueArray {
14621462

14631463
#[doc(alias = "get_element_spec")]
14641464
#[inline]
1465-
pub fn element_spec(&self) -> Option<ParamSpec> {
1465+
pub fn element_spec(&self) -> Option<&ParamSpec> {
14661466
unsafe {
14671467
let ptr = ToGlibPtr::<*const gobject_ffi::GParamSpecValueArray>::to_glib_none(self).0;
14681468

1469-
from_glib_none((*ptr).element_spec)
1469+
if (*ptr).element_spec.is_null() {
1470+
None
1471+
} else {
1472+
Some(
1473+
&*(&(*ptr).element_spec as *const *mut gobject_ffi::GParamSpec
1474+
as *const ParamSpec),
1475+
)
1476+
}
14701477
}
14711478
}
14721479

0 commit comments

Comments
 (0)