#2698 closed bug (Fixed)
Column data indexes corrupted during column removal
Reported by: | Ratanak | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | 1.3.11 |
Component: | GTK UI | Version: | 1.3.10 |
Keywords: | Cc: | Ratanak |
Description
There is a bug in the remove_column code. At line 502 of listview.py:
# Remove from the liststore columns list for index in column_indices: del self.liststore_columns[index]
column_indices is an ascending list of data indexes that a plugin uses. Normally, if a plugin only registers one status field, it loops once and there is no side effect. However, if a plugin registers multiple status fields, deleting indexes in that order will cause the liststore_columns list to be corrupted because any items after the deleted index will be shifted down in the list which would change their indexes as the loop is being executed.
Reversing the order of column_indices should fix the problem.
Change History (5)
follow-up: 2 comment:1 by , 10 years ago
comment:2 by , 10 years ago
Close. You need to assign true to the keyword as follows:
-for index in column_indices: +for index in sorted(column_indices, reverse=True):
comment:3 by , 10 years ago
Ok your mention of status_fields
put me on the wrong path... it was actually an issue with columns using multiple col_types
. Obviously the fix is the same but needed to create a test to cover the problem.
Fixed in 1.3-stable: [dd6e7ec490]
comment:4 by , 10 years ago
Resolution: | → Fixed |
---|---|
Status: | new → closed |
comment:5 by , 10 years ago
Yes, sorry. I was thinking in terms of status fields, but technically it was really about column types.
Thanks. Something like this then?