Fix memory leak in core

This commit is contained in:
Evan Almloff committed 2023-08-15 12:19:05 -05:00
1 parent 1ab5a03aef
commit 943c76b1da
3 files changed
+15 -10

No files matched your search

+6 -2
View File
@@ -87,8 +87,12 @@ impl<'b> VirtualDom {
}
}
// Intialize the root nodes slice
*node.root_ids.borrow_mut() = vec![ElementId(0); node.template.get().roots.len()];
// Initialize the root nodes slice
{
let mut nodes_mut = node.root_ids.borrow_mut();
let len = node.template.get().roots.len();
nodes_mut.resize(len, ElementId::default());
};
// The best renderers will have templates prehydrated and registered
// Just in case, let's create the template using instructions anyways