Potential fix for for
-loop memory leak (#1010)
* fix for-loop memory leak * remove additional unsafe call
This commit is contained in:
parent
d497726d7b
commit
9cbbcb96b3
1 changed files with 2 additions and 6 deletions
|
@ -246,7 +246,7 @@ fn build_loop_special_widget(
|
|||
.collect_vec();
|
||||
let mut created_children = created_children.borrow_mut();
|
||||
for old_child in created_children.drain(..) {
|
||||
unsafe { old_child.destroy() };
|
||||
gtk_container.remove(&old_child);
|
||||
}
|
||||
let mut created_child_scopes = created_child_scopes.borrow_mut();
|
||||
for child_scope in created_child_scopes.drain(..) {
|
||||
|
@ -313,11 +313,7 @@ fn build_children_special_widget(
|
|||
nth_child_widget_use.clone(),
|
||||
None,
|
||||
)?;
|
||||
for old_child in child_container.children() {
|
||||
unsafe {
|
||||
old_child.destroy();
|
||||
}
|
||||
}
|
||||
child_container.children().iter().for_each(|f| child_container.remove(f));
|
||||
child_container.set_child(Some(&new_child_widget));
|
||||
new_child_widget.show();
|
||||
Ok(())
|
||||
|
|
Loading…
Add table
Reference in a new issue