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

Conversation

gycsaba96
Copy link
Contributor

When deleting a task and one of its descendants simultaneously, the program crashes. It happens because it tries to remove the descendant twice: once as a selected task and once as the descendant of the other task.

Steps to reproduce the bug:

  1. Start GTG with the default dataset.
  2. Expand the first task ("Getting Started with GTG (read me first)").
  3. Select the parent tag and its children.
  4. Try to delete them using simultaneously.
  5. Observe the crash.

When deleting multiple tasks simultaneously, we should check that a given task was not already removed as the descendant of a previously removed task.

When deleting multiple tasks simultaneously, we should check that
a given task was not already removed as a descendant of a
previously removed task.
Copy link
Contributor

@SqAtx SqAtx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess you didn't want to do the obvious

item = self.lookup.get(item_id)
if not item:
  return

probably because it might potentially hide problems instead of making us fix them?

I'm fine with that idea. LGTM - I'd just clarify the docstring.

GTG/core/base_store.py Outdated Show resolved Hide resolved
@gycsaba96
Copy link
Contributor Author

I guess you didn't want to do the obvious

item = self.lookup.get(item_id)
if not item:
  return

probably because it might potentially hide problems instead of making us fix them?

Exactly. :) Moreover, doing this would also require us to change the specification of BaseStore.remove, which could potentially break other parts of the code.

@diegogangl
Copy link
Contributor

LGTM, thanks!

@diegogangl diegogangl merged commit 7d112bb into getting-things-gnome:master Dec 1, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants