#3720·CopyQ

The [Tabs] settings array keeps entries for removed and renamed tabs

Author: jkindrixCreated Sep 26, 2026Updated Sep 27, 2026

Describe the bug Entries in the [Tabs] array in copyq.ini are never removed. Tabs::save() in src/common/tabs.cpp opens the array with beginWriteArray("Tabs", m_data->tabs.size()), where the hash was loaded from every existing entry, and then writes rows only for tabs and groups that still exist. QSettings leaves the remaining rows in place, and size stays at the full count, so stale rows are read back on the next load and the array only ever grows.

In my configuration the array had 3,146 entries while 1,825 of them belonged to tabs that no longer existed (old names from before renames, and removed tabs). Every place that scans the array pays for the stale entries too (see #3719).

To Reproduce

  1. Create a tab and give it an icon, so it has an array entry: tab('a'); add('x'); tabIcon('a', 'x').
  2. Rename the tab to b, or remove it.
  3. Look at the [Tabs] section of copyq.ini: the entry named a is still there and size has not decreased.

Expected behavior After a tab is removed or renamed, its old entry disappears from the array, or at least the array is compacted the next time it is saved.

Screenshots Not applicable.

Version, OS and Environment

  • CopyQ 16.0.0, Windows installer (the code in question is unchanged on master)
  • Windows 11 Pro 25H2 (build 26200)

Additional context Found while investigating #3719. Compacting the array in Tabs::save() (writing only the live rows and setting size to that count, after removing the old array) would fix it; I did not include that in the pull request for #3719 to keep it focused, but I can prepare it separately if that is welcome.