Skip to content

Commit

Permalink
Don't crash if polkit doesn't start properly i.e. the bus is already …
Browse files Browse the repository at this point in the history
…claimed. Alert the user they may need to disable an alternate agent.
  • Loading branch information
SparkyBluefang committed Dec 3, 2024
1 parent ab0b401 commit be59a97
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
1 change: 0 additions & 1 deletion debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ Depends:
metacity,
nemo,
network-manager-gnome [linux-any],
policykit-1-gnome,
python3,
python3-dbus,
python3-distro,
Expand Down
20 changes: 19 additions & 1 deletion js/ui/polkitAuthenticationAgent.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ const CinnamonEntry = imports.ui.cinnamonEntry;
const PopupMenu = imports.ui.popupMenu;
const UserWidget = imports.ui.userWidget;
const Util = imports.misc.util;
const Main = imports.ui.main;

const DIALOG_ICON_SIZE = 64;
const DELAYED_RESET_TIMEOUT = 200;
Expand Down Expand Up @@ -523,5 +524,22 @@ var AuthenticationAgent = class {
}

function init() {
let agent = new AuthenticationAgent();
try {
let agent = new AuthenticationAgent();
} catch(err) {
if(!(err instanceof Error)) {
err = new Error(err);
}

log('polkitAuthenticationAgent: init error ' + err);

let icon = new St.Icon({ icon_name: 'dialog-warning',
icon_type: St.IconType.FULLCOLOR,
icon_size: 36 });

Main.warningNotify(_('Unable to start Cinnamon PolicyKit Agent'), err.message +
"\n\n" +
_("If you have another PolicyKit Agent configured to autostart, it should be disabled."),
icon);
}
}

0 comments on commit be59a97

Please sign in to comment.