online-accounts: Fix crash after aborting web view and changing panels

The panel owns both the GtkDialog, and the GoaProvider that is used
with the dialog during goa_provider_add_account. When the panel is
destroyed, it drops its references to the provider but not the dialog,
which is a separate top-level widget. Therefore, if the panel is
switched while the WebKitWebView inside the dialog was still
navigating across pages, then WebKitWebView::decide-policy will be
called with an invalid provider.

To avoid this, and a memory leak, the panel should also destroy the
dialog when it is itself getting destructed.

https://bugzilla.gnome.org/show_bug.cgi?id=782043
This commit is contained in:
Georges Basile Stavracas Neto 2017-08-16 18:53:33 -03:00 committed by Debarshi Ray
parent 17af1865d4
commit 60cf7f6b27

View file

@ -388,6 +388,7 @@ cc_goa_panel_finalize (GObject *object)
CcGoaPanel *panel = CC_GOA_PANEL (object);
g_clear_object (&panel->client);
g_clear_pointer (&panel->edit_account_dialog, gtk_widget_destroy);
G_OBJECT_CLASS (cc_goa_panel_parent_class)->finalize (object);
}