From a66cc9c7435f8282759b8bb5faeb5cb715c63b23 Mon Sep 17 00:00:00 2001 From: Michael Catanzaro Date: Sun, 22 Jan 2017 22:55:57 -0600 Subject: embed-shell: avoid problems when toggling adblock settings --- embed/ephy-embed-shell.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'embed/ephy-embed-shell.c') diff --git a/embed/ephy-embed-shell.c b/embed/ephy-embed-shell.c index b3c7d29da..8e2cfcc76 100644 --- a/embed/ephy-embed-shell.c +++ b/embed/ephy-embed-shell.c @@ -762,7 +762,8 @@ ephy_embed_shell_retrieve_filter_file_finished (GFile *src, /* If failed to retrieve, create an empty file if it doesn't exist to unblock extensions */ stream = g_file_create (data->filter_file, G_FILE_CREATE_NONE, NULL, NULL); - g_object_unref (stream); + if (stream) + g_object_unref (stream); if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) g_warning ("Error retrieving filter %s: %s\n", g_file_get_uri (data->src_file), error->message); @@ -859,9 +860,14 @@ ephy_embed_shell_remove_old_adblock_filters (EphyEmbedShell *shell, static void ephy_embed_shell_update_adblock_filter_files (EphyEmbedShell *shell) { + EphyEmbedShellPrivate *priv = ephy_embed_shell_get_instance_private (shell); char **filters; GList *files = NULL; + /* One at a time please! */ + if (priv->uri_tester_update_cancellable) + g_cancellable_cancel (priv->uri_tester_update_cancellable); + if (!g_settings_get_boolean (EPHY_SETTINGS_WEB, EPHY_PREFS_WEB_ENABLE_ADBLOCK)) { ephy_embed_shell_remove_old_adblock_filters (shell, files); return; -- cgit v1.2.1