pidgin: a336cc1f: Apply patch from darkrain42 to fix the c...

qulogic at pidgin.im qulogic at pidgin.im
Fri Apr 10 03:35:56 EDT 2009


-----------------------------------------------------------------
Revision: a336cc1fd3a1ce815f97303b8d5ae8988f8cbd5b
Ancestor: 8c5b1d77b08657a2e236e8efe9bc2920f763911e
Author: qulogic at pidgin.im
Date: 2009-04-10T05:57:23
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/a336cc1fd3a1ce815f97303b8d5ae8988f8cbd5b

Modified files:
        libpurple/core.c libpurple/plugin.c libpurple/plugin.h

ChangeLog: 

Apply patch from darkrain42 to fix the crash-on-exit. Hopefully, the order
of shutdown is no longer broken now.

Fixes #8774.

-------------- next part --------------
============================================================
--- libpurple/core.c	cae7b4e64221d23012444ddfdc03b3416e7a7e3f
+++ libpurple/core.c	20791733e07fa253248da51b169ec91480aea5f0
@@ -216,16 +216,11 @@ purple_core_quit(void)
 	/* 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();
+	/* 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);
 
-	/* Shut down the UI before all the subsystems */
-	ops = purple_core_get_ui_ops();
-	if (ops != NULL && ops->quit != NULL)
-		ops->quit();
-
 	/* Save .xml files, remove signals, etc. */
 	purple_smileys_uninit();
 	purple_idle_uninit();
@@ -247,7 +242,16 @@ purple_core_quit(void)
 	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
@@ -255,7 +259,7 @@ purple_core_quit(void)
 #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_log_uninit();
 
============================================================
--- libpurple/plugin.c	d0943369db0f9507c5c582df884a6acbd5f0462c
+++ libpurple/plugin.c	fa337da5e2cf783d2758f26ecf3a90327007ce5c
@@ -1234,6 +1234,21 @@ void
 }
 
 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
============================================================
--- libpurple/plugin.h	f9e7eccca6f213e16c7404308fd7d65de075d1af
+++ libpurple/plugin.h	335697ddffb4f659404d1e8182b0a13f39a23c55
@@ -503,6 +503,11 @@ void purple_plugins_unload_all(void);
 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);


More information about the Commits mailing list