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. Note that since the GtkDialog is a template child, it must be destroyed in dispose. GtkWidget's (ie. the panel's) default default destroy signal handler NULLifies all template children pointers, so finalize is too late. https://bugzilla.gnome.org/show_bug.cgi?id=782043
This commit is contained in:
parent
115a1323b4
commit
7ccfa25b47
1 changed files with 12 additions and 0 deletions
|
@ -382,6 +382,17 @@ cc_goa_panel_set_property (GObject *object,
|
|||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
}
|
||||
|
||||
static void
|
||||
cc_goa_panel_dispose (GObject *object)
|
||||
{
|
||||
CcGoaPanel *panel = CC_GOA_PANEL (object);
|
||||
|
||||
/* Must be destroyed in dispose, not finalize. */
|
||||
g_clear_pointer (&panel->edit_account_dialog, gtk_widget_destroy);
|
||||
|
||||
G_OBJECT_CLASS (cc_goa_panel_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
static void
|
||||
cc_goa_panel_finalize (GObject *object)
|
||||
{
|
||||
|
@ -495,6 +506,7 @@ cc_goa_panel_class_init (CcGoaPanelClass *klass)
|
|||
object_class->set_property = cc_goa_panel_set_property;
|
||||
object_class->finalize = cc_goa_panel_finalize;
|
||||
object_class->constructed = cc_goa_panel_constructed;
|
||||
object_class->dispose = cc_goa_panel_dispose;
|
||||
|
||||
g_object_class_override_property (object_class, PROP_PARAMETERS, "parameters");
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue