20 Aug 13:20
Difficult bug
From: Jerome Laheurte <fraca7@...>
Subject: Difficult bug
Newsgroups: gmane.comp.sysutils.pim.taskcoach.devel
Date: 2008-08-20 11:24:44 GMT
Subject: Difficult bug
Newsgroups: gmane.comp.sysutils.pim.taskcoach.devel
Date: 2008-08-20 11:24:44 GMT
Hi, Frank. I found a bug and I'm at loss as to how to fix it; I see
several solutions but they may have other impacts...
The bug: Start with an empty file, create a category, then a
subcategory, then a task. Edit the parent category and click OK. Edit
the task. The result:
File
"/home/jla/WinHome/dev/fraca7/taskcoach-trunk/taskcoachlib/gui/dialog/editor.py",
line 531, in getCategoryWithIndex
category = children[i]
IndexError: list index out of range
After some digging, I found out that when the category's state is
saved, patterns.Composite makes a copy of the children. Thus, when the
edit is undone, the category's children are replaced with copies. But
the global list of categories keeps the old versions.
As default object comparison is based on id, a category and its copy
are considered different and bad things happen.
First thought: overload __contains__ in Sorter to compare items
according to their __id. This fails because the copy generates a new
__id (and I saw a comment about that so I guess it's intended). Would
keeping the __id in a copy break something ? Does this fix other
potential bugs due to the same root ?
Second thought: avoid copying in __getstate__, just keep the original
instances. I'm pretty sure this will have side effects, though a
(Continue reading)
I took the opportunity to reorganize the feature administration a bit:
- Priority 1 is used for features that are implemented: set a feature
request to priority 1 when you commit the feature and use the 'feature
implemented' canned message to notify the submitter
- New features get a default priority of 2: when a new feature is
requested use the 'thanks for submitting a feature request' canned
message and set the priority to 2.
- Priority 3 is used for features with multiple requesters; when other
people than the original submitter voice their support for the
feature, the priority is increased to 3, no canned message needed.
- Priority 4 is used for features where a donation is offered.
- Priotity 5 and higher are reserved for future use
RSS Feed