[gnome-control-center/gnome-3-34] online-accounts: Don't segfault if get_all_providers_cb is called during init
- From: Robert Ancell <rancell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center/gnome-3-34] online-accounts: Don't segfault if get_all_providers_cb is called during init
- Date: Mon, 9 Sep 2019 22:37:12 +0000 (UTC)
commit b614a6c02365e8118143d14c24a9140bd5e72f8b
Author: Andrea Azzarone <andrea azzarone canonical com>
Date: Tue Mar 5 18:21:39 2019 +0000
online-accounts: Don't segfault if get_all_providers_cb is called during init
Due to an API bug in GNOME Online Accounts, the asynchronous
goa_provider_get_all method doesn't accept a GCancellable argument. This makes
it difficult to cancel an ongoing call when the CcGoaPanel gets destroyed.
This was hacked around by taking a reference on the panel for the duration of
the call. Instead of cancelling a pending call on destruction, it would keep the
panel alive until the call was over.
The hack does not consider the case get_all_providers_cb is called while the
panel is still being initialized. E.g. this happen when create the panel passing
the paramenters "add <provider>" because the constuct properties are set just
after cc_goa_panel_init returns and because goa_provider_add_account will result
in a call to g_main_context_iterate (caused by gtk_dialog_run).
In order to work around this we can call goa_provider_get_all in _constructed()
after all construct properties have been set.
https://gitlab.gnome.org/GNOME/gnome-control-center/issues/401
panels/online-accounts/cc-online-accounts-panel.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
---
diff --git a/panels/online-accounts/cc-online-accounts-panel.c
b/panels/online-accounts/cc-online-accounts-panel.c
index 186c704f8..0af60fc1f 100644
--- a/panels/online-accounts/cc-online-accounts-panel.c
+++ b/panels/online-accounts/cc-online-accounts-panel.c
@@ -498,7 +498,6 @@ cc_goa_panel_init (CcGoaPanel *panel)
panel);
fill_accounts_listbox (panel);
- goa_provider_get_all (get_all_providers_cb, g_object_ref_sink (panel));
gtk_widget_show (GTK_WIDGET (panel));
}
@@ -520,6 +519,8 @@ cc_goa_panel_constructed (GObject *object)
gtk_window_set_transient_for (GTK_WINDOW (self->edit_account_dialog), parent);
+ goa_provider_get_all (get_all_providers_cb, g_object_ref_sink (self));
+
G_OBJECT_CLASS (cc_goa_panel_parent_class)->constructed (object);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]