Merge lp://staging/~a-j-buxton/xfpanel-switch/orphan-plugins into lp://staging/~xfpanel-switch-dev/xfpanel-switch/trunk

Proposed by Alistair Buxton
Status: Merged
Merged at revision: 146
Proposed branch: lp://staging/~a-j-buxton/xfpanel-switch/orphan-plugins
Merge into: lp://staging/~xfpanel-switch-dev/xfpanel-switch/trunk
Diff against target: 84 lines (+39/-7)
1 file modified
xfpanel-switch/panelconfig.py (+39/-7)
To merge this branch: bzr merge lp://staging/~a-j-buxton/xfpanel-switch/orphan-plugins
Reviewer Review Type Date Requested Status
Xfce4 Panel Profiles Team Pending
Review via email: mp+343664@code.staging.launchpad.net

Commit message

Fix (LP: #1765565): Don't crash on corrupted panel configs.

1. Fix the problem directly:

Catch the exception if the .desktop file is missing and return false.
This will remove launchers with missing .desktop (not just the binary).

2. Fix the problem more generally:

Ignore orphan plugin configurations. This is a plugin configuration
section which is not refered to by any panel and therefore is not used.
Some old versions of xfce4-panel seem to create these, but I can't
reproduce with the latest version.

These orphans are completely ignored by the panel. Xfpanel-switch also
ignores them, unless they are launchers with missing .desktop files.
The second part of this patch cleans them out anyway.

Description of the change

This is tricky to test as it requires you to have a previously unidentified corruption in your panel config. However, the reporter reported that it worked on IRC. I have not heavily tested it, but it appears to have saved my configuration okay too.

In order to test it you'll have to intentionally break the panel config: add a bunch of launchers, plugins etc, then delete them from panels/panel-N/plugin-ids using settings editor so that they become orphans. Then save the configuration and load it again. The orphans should be gone.

Next add a launcher and delete the .desktop from ~/.config/xfce4/panel/. Again save and load and thebroken launcher should be gone.

In neither case should it crash. :)

To post a comment you must log in.
143. By Alistair Buxton

Be careful about which plugins are deleted.

If the key /plugins/plugin-2 is deemed to be bad, we should not delete
/plugins/plugin-20 for example. So check that the keys to be deleted
either exactly match, or start with the pattern + '/'.

144. By Alistair Buxton

Check for orphans also when loading a config.

Because of the way the configuration copying is used, sometimes orphans
can persist in configs (because they don't go through xfconf.)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches