From 6910818986b10b74b4fa264b696edd931cf800d4 Mon Sep 17 00:00:00 2001 From: sandorstormen Date: Sun, 7 Dec 2025 07:48:01 +0100 Subject: [PATCH 1/2] Add handling for EntrypointConnectionItem deletion in DeleteCommand --- mal_gui/undo_redo_commands/delete_command.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/mal_gui/undo_redo_commands/delete_command.py b/mal_gui/undo_redo_commands/delete_command.py index 32d94a4..c00a731 100644 --- a/mal_gui/undo_redo_commands/delete_command.py +++ b/mal_gui/undo_redo_commands/delete_command.py @@ -32,6 +32,13 @@ def redo(self): for connection in self.connections: connection.remove_labels() self.scene.removeItem(connection) + if isinstance(connection, EntrypointConnectionItem): + step_full_name = connection.asset_item.asset.name + ":" + connection.attack_step_name + try: + connection.attacker_item.entry_points.remove(step_full_name) + except ValueError: + print(f"Entrypoint {step_full_name} not found in attacker {connection.attacker_item.name}") + for item in self.items: if isinstance(item, AssetItem): From e918c55ed11ae4f780a25339aedaf1d49938b842 Mon Sep 17 00:00:00 2001 From: Joakim Loxdal Date: Tue, 9 Dec 2025 11:05:42 +0100 Subject: [PATCH 2/2] fix: Add the entrypoint to the attacker again when undoing delete of an entrypoint connection --- mal_gui/undo_redo_commands/delete_command.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/mal_gui/undo_redo_commands/delete_command.py b/mal_gui/undo_redo_commands/delete_command.py index c00a731..16149dd 100644 --- a/mal_gui/undo_redo_commands/delete_command.py +++ b/mal_gui/undo_redo_commands/delete_command.py @@ -32,6 +32,7 @@ def redo(self): for connection in self.connections: connection.remove_labels() self.scene.removeItem(connection) + if isinstance(connection, EntrypointConnectionItem): step_full_name = connection.asset_item.asset.name + ":" + connection.attack_step_name try: @@ -69,10 +70,10 @@ def undo(self): connection.attacker_item, connection.asset_item ) - # connection.attacker_item.attacker.add_entry_point( - # connection.asset_item.asset, connection.attack_step_name - # ) - + step_full_name = ( + connection.asset_item.asset.name + ":" + connection.attack_step_name + ) + connection.attacker_item.entry_points.append(step_full_name) elif isinstance(connection, AssociationConnectionItem): self.scene.add_association_connection(