Opened 5 years ago

Closed 3 years ago

#2256 closed patch (Fixed)

Indexes aren't updated properly when removing columns

Reported by: Ratanak Owned by:
Priority: minor Milestone: 1.3.10
Component: GTK UI Version: 1.3.5
Keywords: Cc: Ratanak

Description

I've been experimenting with columns in the torrent view and found that the indexes keeping track of which ListStore columns are used by a plugin's view column are not updated properly when another plugin's column is removed. This can lead to the column rendering the wrong data in the view. Default columns are not affected since they have fixed indexes, but this can be an issue for plugin developers.

Attachments (2)

listview.py.diff (729 bytes) - added by Ratanak 5 years ago.
Patch that properly updates ListStore indexes
listview.py.2.diff (4.0 KB) - added by Ratanak 5 years ago.
Patch that updates TreeViewColumn indexes (includes first patch)

Download all attachments as: .zip

Change History (5)

comment:1 Changed 5 years ago by Ratanak

Fixing the ListStore indexes revealed a deeper issue that better explains why plugin columns were rendering other plugins' column data. It turns out that the TreeViewColumn also needs updating.

When a TreeViewColumn is created, its CellRenderer is given a fixed ListStore column number. Later, when that column number changes (when a column is removed), the CellRenderer continues to use the old column index. For example:

There are two plugins that add columns to the view. After the new ListStore is created with the additional columns, its length is now 29 (indexes 0-28). The plugin "One" indexes a ListStore position 27 and the plugin "Two" indexes position 28. Their respective TreeViewColumn are given those indexes when they are created.

Now, plugin "One" is disabled and the column is removed. A new ListStore is created with the column removed and now its length is 28 (indexes 0-27). With the first patch I posted, plugin "Two" now indexes position 27 in the ListStore while its TreeViewColumn is still set to position 28 (without the first patch, it still indexes position 28). This causes it to not render any cell data because it is out of the ListStore index range.

Re-enabling "One" will cause the ListStore to change back to length 29 (indexes 0-28) with plugin "One" indexing the appended column, position 28. And so, data that is supposed to appear in plugin "One"'s column also appears in plugin "Two"'s column.

I have added another patch that should resolve the TreeViewColumn index not being updated.

Changed 5 years ago by Ratanak

Patch that properly updates ListStore indexes

Changed 5 years ago by Ratanak

Patch that updates TreeViewColumn indexes (includes first patch)

comment:4 Changed 3 years ago by Cas

  • Milestone changed from 1.3.x to 1.3.10
  • Resolution set to Fixed
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.