Skip to content

Commit 7cdf638

Browse files
author
Nikolas Dahn
committed
Cleanup
1 parent f5e37cd commit 7cdf638

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

hkb_editor/gui/beh_editor.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1526,17 +1526,19 @@ def _delete_node_cascade(self, node: Node) -> None:
15261526
for n in children:
15271527
for parent in root_graph.predecessors(n):
15281528
if parent != node.id and parent not in children:
1529-
# Found a parent outside the to be deleted subtree, keep this child
1529+
# Found a parent outside the to-be-deleted subtree, keep this child
15301530
break
15311531
else:
1532+
# All parents are in the to-be-deleted subtree, nuke it
15321533
delete_list.append(n)
15331534

15341535
self.logger.info(
15351536
f"Deleting {len(delete_list)} descendants of node {node.id} with no other parents"
15361537
)
15371538
with self.beh.transaction():
1539+
# Update all references while the node is still alive, then delete all
1540+
# descendants with no outside parents
15381541
self._on_node_delete(node.id)
1539-
15401542
for n in reversed(delete_list):
15411543
self.beh.delete_object(n)
15421544

0 commit comments

Comments
 (0)