Skip to content

Commit 51f67f3

Browse files
committed
gtk: Don't leak temporary hash table in ConstraintLayout::add_constraints_from_description
Fixes #2119
1 parent f1d66fc commit 51f67f3

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

gtk4/src/constraint_layout.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@ impl ConstraintLayout {
2121
Some(glib::ffi::g_str_hash),
2222
Some(glib::ffi::g_str_equal),
2323
Some(glib::ffi::g_free),
24-
Some(glib::ffi::g_free),
24+
None,
2525
);
2626

2727
for (key, widget) in views {
2828
let key_ptr: *mut libc::c_char = key.to_glib_full();
2929
glib::ffi::g_hash_table_insert(
3030
hash_table,
3131
key_ptr as *mut _,
32-
widget.to_glib_full() as *mut _,
32+
widget.as_ptr() as *mut _,
3333
);
3434
}
3535

@@ -43,6 +43,9 @@ impl ConstraintLayout {
4343
hash_table,
4444
&mut err,
4545
);
46+
47+
glib::ffi::g_hash_table_unref(hash_table);
48+
4649
if !err.is_null() {
4750
Err(from_glib_full(err))
4851
} else {

0 commit comments

Comments
 (0)