changeset 25375:fc8fd4fef166

Fix a crash on exit with a patch from im.pidgin.next.minor. applied changes from bab46e2dd9ebff11705234f606d600c9c78011bb through a515a270e1782f14b92ccfef56e731de38407ac6 aa60091ae5c724a0c287dff08ae64eead7163d67: Uninitialize the certificate API before unloading the SSL plugin. This prevents a crash at shutdown that I assume started happening when we re-arranged the uninit stuff. See the comment for more details. This change should probably be made in im.pidgin.pidgin. a515a270e1782f14b92ccfef56e731de38407ac6: Simplify, hoo-boy. Also don't unregister the schemes in purple_certificate_uninit(). The schemes should be unregistered by whoever registered them in the first place (the ssl plugins)
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Tue, 27 Jan 2009 04:36:30 +0000
parents a8db457c421a
children a1c4ae9a2fcc
files libpurple/certificate.c libpurple/core.c
diffstat 2 files changed, 10 insertions(+), 23 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/certificate.c	Mon Jan 26 02:39:50 2009 +0000
+++ b/libpurple/certificate.c	Tue Jan 27 04:36:30 2009 +0000
@@ -1546,31 +1546,11 @@
 void
 purple_certificate_uninit(void)
 {
-	GList *full_list, *l;
-
-	/* Unregister all Schemes */
-	full_list = g_list_copy(cert_schemes); /* Make a working copy */
-	for (l = full_list; l; l = l->next) {
-		purple_certificate_unregister_scheme(
-			(PurpleCertificateScheme *) l->data );
-	}
-	g_list_free(full_list);
-
 	/* Unregister all Verifiers */
-	full_list = g_list_copy(cert_verifiers); /* Make a working copy */
-	for (l = full_list; l; l = l->next) {
-		purple_certificate_unregister_verifier(
-			(PurpleCertificateVerifier *) l->data );
-	}
-	g_list_free(full_list);
+	g_list_foreach(cert_verifiers, (GFunc)purple_certificate_unregister_verifier, NULL);
 
 	/* Unregister all Pools */
-	full_list = g_list_copy(cert_pools); /* Make a working copy */
-	for (l = full_list; l; l = l->next) {
-		purple_certificate_unregister_pool(
-			(PurpleCertificatePool *) l->data );
-	}
-	g_list_free(full_list);
+	g_list_foreach(cert_pools, (GFunc)purple_certificate_unregister_pool, NULL);
 }
 
 gpointer
--- a/libpurple/core.c	Mon Jan 26 02:39:50 2009 +0000
+++ b/libpurple/core.c	Tue Jan 27 04:36:30 2009 +0000
@@ -198,6 +198,14 @@
 	/* Transmission ends */
 	purple_connections_disconnect_all();
 
+	/*
+	 * Certificates must be destroyed before the SSL plugins, because
+	 * PurpleCertificates contain pointers to PurpleCertificateSchemes,
+	 * and the PurpleCertificateSchemes will be unregistered when the
+	 * SSL plugin is uninit.
+	 */
+	purple_certificate_uninit();
+
 	/* The SSL plugins must be uninit before they're unloaded */
 	purple_ssl_uninit();
 
@@ -220,7 +228,6 @@
 	purple_notify_uninit();
 	purple_conversations_uninit();
 	purple_connections_uninit();
-	purple_certificate_uninit();
 	purple_buddy_icons_uninit();
 	purple_accounts_uninit();
 	purple_savedstatuses_uninit();