libpurple 32339:a05c441cfdc5: Add this as a workaround for libxm...

commits at adium.im commits at adium.im
Sun Aug 5 20:36:24 UTC 2012


details:	http://hg.adium.im/libpurple/rev/a05c441cfdc5
revision:	32339:a05c441cfdc5
branch:		adium
author:		Thijs Alkemade <thijsalkemade at gmail.com>
date:		Sun Aug 05 22:35:43 2012 +0200

Add this as a workaround for libxml2 on Mac OS X 10.8, as it calls this callback without the proper user_data.

http://trac.adium.im/ticket/16095

diffs (28 lines):

diff -r c1b085cd4da3 -r a05c441cfdc5 libpurple/xmlnode.c
--- a/libpurple/xmlnode.c	Wed Jun 13 19:33:27 2012 -0400
+++ b/libpurple/xmlnode.c	Sun Aug 05 22:35:43 2012 +0200
@@ -752,10 +752,23 @@
 static void
 xmlnode_parser_structural_error_libxml(void *user_data, xmlErrorPtr error)
 {
+	// On Mac OS X 10.8 libxml2 will call this function with user_data == NULL
+	// if xmlSetStructuredErrorFunc was set. Use this as a workaround.
+	// http://trac.adium.im/ticket/16095
+	
 	struct _xmlnode_parser_data *xpd = user_data;
 
+	if (error && !xpd) {
+		xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr)error->ctxt;
+		
+		if (ctxt) {
+			xpd = ctxt->userData;
+		}
+	}
+
 	if (error && (error->level == XML_ERR_ERROR ||
-	              error->level == XML_ERR_FATAL)) {
+	              error->level == XML_ERR_FATAL)
+		&& xpd) {
 		xpd->error = TRUE;
 		purple_debug_error("xmlnode", "XML parser error for xmlnode %p: "
 		                   "Domain %i, code %i, level %i: %s",




More information about the commits mailing list