diff -Nru software-properties-0.97.8/debian/changelog software-properties-0.97.9/debian/changelog --- software-properties-0.97.8/debian/changelog 2019-02-22 01:49:39.000000000 +0000 +++ software-properties-0.97.9/debian/changelog 2019-03-14 23:11:37.000000000 +0000 @@ -1,3 +1,11 @@ +software-properties (0.97.9) disco; urgency=medium + + [ Andrea Azzarone ] + * Don't segfault if GoaClient.new fails. Also make it async to not + block the UI. (lp: #1818992) + + -- Sebastien Bacher Fri, 15 Mar 2019 00:10:08 +0100 + software-properties (0.97.8) disco; urgency=medium * Change debconf frontend to kde for software-properties-qt. diff -Nru software-properties-0.97.8/softwareproperties/GoaAuth.py software-properties-0.97.9/softwareproperties/GoaAuth.py --- software-properties-0.97.8/softwareproperties/GoaAuth.py 2019-02-22 01:49:39.000000000 +0000 +++ software-properties-0.97.9/softwareproperties/GoaAuth.py 2019-03-14 23:11:59.000000000 +0000 @@ -21,7 +21,9 @@ import gi gi.require_version('Goa', '1.0') -from gi.repository import Gio, Goa, GObject +from gi.repository import Gio, GLib, Goa, GObject + +import logging class GoaAuth(GObject.GObject): @@ -32,12 +34,21 @@ def __init__(self): GObject.GObject.__init__(self) - self.goa_client = Goa.Client.new_sync(None) self.account = None + self.cancellable = Gio.Cancellable() + Goa.Client.new(self.cancellable, self._on_goa_client_ready) self.settings = Gio.Settings.new('com.ubuntu.SoftwareProperties') self.settings.connect('changed::goa-account-id', self._on_settings_changed) - self._load() + + def _on_goa_client_ready(self, source, res): + try: + self.goa_client = Goa.Client.new_finish(res) + except GLib.Error as e: + logging.error('Failed to get a Gnome Online Account: {}'.format(e.message)) + self.goa_client = None + else: + self._load() def login(self, account): assert(account) @@ -50,7 +61,7 @@ @GObject.Property def token(self): - if self.account is None: + if self.account is None or self.goa_client is None: return None obj = self.goa_client.lookup_by_id(self.account.props.id) @@ -64,7 +75,7 @@ return pbased.call_get_password_sync('livepatch') def _update_state_from_account_id(self, account_id): - if account_id: + if account_id and self.goa_client is not None: # Make sure the account-id is valid obj = self.goa_client.lookup_by_id(account_id) if obj is None: