Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix crash when deleting a task and its descendant together #1159

Merged
merged 2 commits into from
Dec 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions GTG/core/base_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,13 @@ def remove(self, item_id: UUID) -> None:
self.emit('removed', str(item_id))


def batch_remove(self,item_ids: List[UUID]) -> None:
"""Remove multiple items, ensuring nothing gets deleted twice"""
for key in item_ids:
if key in self.lookup:
self.remove(key)


# --------------------------------------------------------------------------
# PARENTING
# --------------------------------------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions GTG/gtk/browser/delete_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ def on_response(self, dialog, response, tasklist, callback):

def on_delete_confirm(self, tasklist):

for task in tasklist:
self.ds.tasks.remove(task.id)
task_ids = [ t.id for t in tasklist ]
self.ds.tasks.batch_remove(task_ids)


def recursive_list_tasks(self, tasklist, root):
Expand Down