pidgin: c84d4a5e: Fix a crash on exit with a patch from im...

qulogic at pidgin.im qulogic at pidgin.im
Tue Jan 27 00:25:46 EST 2009


-----------------------------------------------------------------
Revision: c84d4a5e8b98bbeb4780bca72f4c034bc541881b
Ancestor: 566d2e86bfd45c806aba1b32d6f85a9a409ff9ea
Author: qulogic at pidgin.im
Date: 2009-01-27T04:36:30
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/c84d4a5e8b98bbeb4780bca72f4c034bc541881b

Modified files:
        libpurple/certificate.c libpurple/core.c

ChangeLog: 

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)

-------------- next part --------------
============================================================
--- libpurple/certificate.c	9995d369819ae34fce47d4c0c2a95bc4902bf27b
+++ libpurple/certificate.c	68942f72b6d9884d99d3f785f51cdb49dc7828a8
@@ -1546,31 +1546,11 @@ purple_certificate_uninit(void)
 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
============================================================
--- libpurple/core.c	e201d2611dfde87f9b6ec35aa8ef0c8c5ab8d8e8
+++ libpurple/core.c	7901b8aea56c0d511c622be638656e6dd7e3c45f
@@ -198,6 +198,14 @@ purple_core_quit(void)
 	/* 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_core_quit(void)
 	purple_notify_uninit();
 	purple_conversations_uninit();
 	purple_connections_uninit();
-	purple_certificate_uninit();
 	purple_buddy_icons_uninit();
 	purple_accounts_uninit();
 	purple_savedstatuses_uninit();


More information about the Commits mailing list