Crash under config_lookup_thread() at e-config-lookup.c:179

This could happen when an ongoing thread had been left running after
the EConfigLookup instance had been freed, even the task itself had
been cancelled. The thread pool free reorder fixes it, together with
the changed way to free it. The other parts avoid unnecessary runtime
warnings in case the crash conditions would be triggered.
This commit is contained in:
Milan Crha
2018-08-23 10:26:36 +02:00
parent 92b015b9d6
commit fccc5eda57
3 changed files with 8 additions and 6 deletions

View File

@ -1858,8 +1858,6 @@ collection_account_wizard_dispose (GObject *object)
wizard->priv->store_passwords = NULL;
}
g_warn_if_fail (wizard->priv->running_result == NULL);
if (wizard->priv->running_result) {
e_simple_async_result_complete_idle (wizard->priv->running_result);
g_clear_object (&wizard->priv->running_result);

View File

@ -277,6 +277,11 @@ config_lookup_dispose (GObject *object)
e_config_lookup_cancel_all (config_lookup);
if (config_lookup->priv->pool) {
g_thread_pool_free (config_lookup->priv->pool, TRUE, TRUE);
config_lookup->priv->pool = NULL;
}
g_mutex_lock (&config_lookup->priv->property_lock);
g_clear_object (&config_lookup->priv->run_cancellable);
@ -305,7 +310,6 @@ config_lookup_finalize (GObject *object)
EConfigLookup *config_lookup = E_CONFIG_LOOKUP (object);
g_slist_free_full (config_lookup->priv->results, g_object_unref);
g_thread_pool_free (config_lookup->priv->pool, TRUE, FALSE);
g_mutex_clear (&config_lookup->priv->property_lock);
/* Chain up to parent's method. */

View File

@ -509,21 +509,21 @@ mail_autoconfig_lookup (EMailAutoconfig *autoconfig,
(GDestroyNotify) g_object_unref);
/* First try user configuration in autoconfig.$DOMAIN URL and ignore error */
if (!success && !g_cancellable_is_cancelled (cancellable)) {
if (!success && ((error && !*error && !g_cancellable_set_error_if_cancelled (cancellable, error)) || !g_cancellable_is_cancelled (cancellable))) {
uri = g_strconcat ("http://autoconfig.", domain, "/mail/config-v1.1.xml?emailaddress=" FAKE_EVOLUTION_USER_STRING "%40", domain, NULL);
success = mail_autoconfig_lookup_uri_sync (autoconfig, uri, soup_session, cancellable, NULL);
g_free (uri);
}
/* Then with $DOMAIN/.well-known/autoconfig/ and ignore error */
if (!success && !g_cancellable_is_cancelled (cancellable)) {
if (!success && ((error && !*error && !g_cancellable_set_error_if_cancelled (cancellable, error)) || !g_cancellable_is_cancelled (cancellable))) {
uri = g_strconcat ("http://", domain, "/.well-known/autoconfig/mail/config-v1.1.xml?emailaddress=" FAKE_EVOLUTION_USER_STRING "%40", domain, NULL);
success = mail_autoconfig_lookup_uri_sync (autoconfig, uri, soup_session, cancellable, NULL);
g_free (uri);
}
/* Final, try the upstream ISPDB and propagate error */
if (!success && !g_cancellable_is_cancelled (cancellable)) {
if (!success && ((error && !*error && !g_cancellable_set_error_if_cancelled (cancellable, error)) || !g_cancellable_is_cancelled (cancellable))) {
uri = g_strconcat (AUTOCONFIG_BASE_URI, domain, NULL);
success = mail_autoconfig_lookup_uri_sync (autoconfig, uri, soup_session, cancellable, error);
g_free (uri);