changeset 25856:1b8c18ab762f

applied changes from 8c5b1d77b08657a2e236e8efe9bc2920f763911e through a336cc1fd3a1ce815f97303b8d5ae8988f8cbd5b ChangeLog for the above.
author Ethan Blanton <elb@pidgin.im>
date Tue, 28 Apr 2009 20:51:59 +0000
parents 96e54eb6100a
children d5cf115b7c58 d51b8647d43c
files ChangeLog libpurple/core.c libpurple/plugin.c libpurple/plugin.h
diffstat 4 files changed, 38 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Tue Apr 28 20:49:36 2009 +0000
+++ b/ChangeLog	Tue Apr 28 20:51:59 2009 +0000
@@ -1,6 +1,9 @@
 Pidgin and Finch: The Pimpin' Penguin IM Clients That're Good for the Soul
 
 version 2.5.6 (??/??/2009):
+	libpurple:
+	* Fix various crashes on exit.
+
 	IRC:
 	* Correctly handle WHOIS for users who are joined to a large number of
 	  channels.
--- a/libpurple/core.c	Tue Apr 28 20:49:36 2009 +0000
+++ b/libpurple/core.c	Tue Apr 28 20:51:59 2009 +0000
@@ -209,15 +209,10 @@
 	/* The SSL plugins must be uninit before they're unloaded */
 	purple_ssl_uninit();
 
-	/* Unload all plugins before the UI because UI plugins might call
-	 * UI-specific functions */
-	purple_debug_info("main", "Unloading all plugins\n");
-	purple_plugins_destroy_all();
-
-	/* Shut down the UI before all the subsystems */
-	ops = purple_core_get_ui_ops();
-	if (ops != NULL && ops->quit != NULL)
-		ops->quit();
+	/* Unload all non-loader, non-prpl plugins before shutting down
+	 * subsystems. */
+	purple_debug_info("main", "Unloading normal plugins\n");
+	purple_plugins_unload(PURPLE_PLUGIN_STANDARD);
 
 	/* Save .xml files, remove signals, etc. */
 	purple_smileys_uninit();
@@ -239,7 +234,16 @@
 	purple_imgstore_uninit();
 	purple_network_uninit();
 
-	/* Everything after this must not try to read any prefs */
+	/* Everything after unloading all plugins must not fail if prpls aren't
+	 * around */
+	purple_debug_info("main", "Unloading all plugins\n");
+	purple_plugins_destroy_all();
+
+	ops = purple_core_get_ui_ops();
+	if (ops != NULL && ops->quit != NULL)
+		ops->quit();
+
+	/* Everything after prefs_uninit must not try to read any prefs */
 	purple_prefs_uninit();
 	purple_plugins_uninit();
 #ifdef HAVE_DBUS
@@ -247,7 +251,7 @@
 #endif
 
 	purple_cmds_uninit();
-	/* Everything after this cannot try to write things to the confdir */
+	/* Everything after util_uninit cannot try to write things to the confdir */
 	purple_util_uninit();
 
 	purple_signals_uninit();
--- a/libpurple/plugin.c	Tue Apr 28 20:49:36 2009 +0000
+++ b/libpurple/plugin.c	Tue Apr 28 20:51:59 2009 +0000
@@ -1229,6 +1229,21 @@
 }
 
 void
+purple_plugins_unload(PurplePluginType type)
+{
+#ifdef PURPLE_PLUGINS
+	GList *l;
+
+	for (l = plugins; l; l = l->next) {
+		PurplePlugin *plugin = l->data;
+		if (plugin->info->type == type && purple_plugin_is_loaded(plugin))
+			purple_plugin_unload(plugin);
+	}
+
+#endif /* PURPLE_PLUGINS */
+}
+
+void
 purple_plugins_destroy_all(void)
 {
 #ifdef PURPLE_PLUGINS
--- a/libpurple/plugin.h	Tue Apr 28 20:49:36 2009 +0000
+++ b/libpurple/plugin.h	Tue Apr 28 20:51:59 2009 +0000
@@ -503,6 +503,11 @@
 void purple_plugins_unload_all(void);
 
 /**
+ * Unloads all plugins of a specific type.
+ */
+void purple_plugins_unload(PurplePluginType type);
+
+/**
  * Destroys all registered plugins.
  */
 void purple_plugins_destroy_all(void);