fix memory leak

This commit is contained in:
Evan Almloff committed 2022-12-06 09:54:44 -06:00
1 parent 4b1c6125d4
commit 77381ceadd
1 file changed
+4
+4
View File
@@ -76,6 +76,10 @@ impl<S: State> RealDom<S> {
if self.node_id_mapping.len() <= element_id.0 {
self.node_id_mapping.resize(element_id.0 + 1, None);
}
if let Some(Some(old_id)) = self.node_id_mapping.get(element_id.0) {
// free the memory associated with the old node
self.tree.remove(*old_id);
}
self.node_id_mapping[element_id.0] = Some(node_id);
}