changeset 27606:386265b369c9

Add PURPLE_LEAKCHECK_HELP environment variable. See ChangeLog.
author Paul Aurich <paul@darkrain42.org>
date Sat, 18 Jul 2009 05:26:23 +0000
parents 37b668b8d6c1
children f95bcb5eb047
files ChangeLog libpurple/plugin.c
diffstat 2 files changed, 17 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sat Jul 18 05:08:25 2009 +0000
+++ b/ChangeLog	Sat Jul 18 05:26:23 2009 +0000
@@ -20,10 +20,16 @@
 	  PURPLE_GNUTLS_DEBUG environment variable, which is an integer between
 	  0 and 9 (higher is more verbose). Higher values may reveal sensitive
 	  information.
-	* PURPLE_VERBOSE_DEBUG environment variable.  Currently this is an "on" or
+	* PURPLE_VERBOSE_DEBUG environment variable.  Currently, this is an "on" or
 	  "off" variable.  Set it to any value to turn it on and unset it to turn
 	  it off.  This will optionally be used to only show less useful debug
 	  information on an as-needed basis.
+	* PURPLE_LEAKCHECK_HELP environment variable.  Currently, this is an "on"
+	  or "off" variable.  Set it to any value to turn it on and unset it to
+	  turn it off.  This will be used to perform various actions that are
+	  useful when running libpurple inside of Valgrind or similar programs.
+	  Currently, it keeps plugins in memory, allowing Valgrind to perform
+	  symbol resolution of leak traces at shutdown.
 	* Add support for receiving handwritten (ink) messages on MSN.
 	* Don't do IPv6 address lookups if the computer does not have an IPv6
 	  address configured.
--- a/libpurple/plugin.c	Sat Jul 18 05:08:25 2009 +0000
+++ b/libpurple/plugin.c	Sat Jul 18 05:26:23 2009 +0000
@@ -870,8 +870,16 @@
 		if (plugin->info != NULL && plugin->info->destroy != NULL)
 			plugin->info->destroy(plugin);
 
-		if (plugin->handle != NULL)
-			g_module_close(plugin->handle);
+		/*
+		 * I find it extremely useful to do this when using valgrind, as
+		 * it keeps all the plugins open, meaning that valgrind is able to
+		 * resolve symbol names in leak traces from plugins.
+		 */
+		if (!g_getenv("PURPLE_LEAKCHECK_HELP"))
+		{
+			if (plugin->handle != NULL)
+				g_module_close(plugin->handle);
+		}
 	}
 	else
 	{