comparison src/plugin.c @ 12992:9d8025ec5e23

[gaim-migrate @ 15345] Etan is right about the dependent plugin unloading. committer: Tailor Script <tailor@pidgin.im>
author Richard Laager <rlaager@wiktel.com>
date Sun, 22 Jan 2006 21:14:40 +0000
parents de3a3669dbe1
children a0a4b44239e8
comparison
equal deleted inserted replaced
12991:c1b2ba353e85 12992:9d8025ec5e23
605 605
606 gboolean 606 gboolean
607 gaim_plugin_unload(GaimPlugin *plugin) 607 gaim_plugin_unload(GaimPlugin *plugin)
608 { 608 {
609 #ifdef GAIM_PLUGINS 609 #ifdef GAIM_PLUGINS
610 GList *l, *l_next; 610 GList *l;
611 611
612 g_return_val_if_fail(plugin != NULL, FALSE); 612 g_return_val_if_fail(plugin != NULL, FALSE);
613 613
614 loaded_plugins = g_list_remove(loaded_plugins, plugin); 614 loaded_plugins = g_list_remove(loaded_plugins, plugin);
615 if ((plugin->info != NULL) && GAIM_IS_PROTOCOL_PLUGIN(plugin)) 615 if ((plugin->info != NULL) && GAIM_IS_PROTOCOL_PLUGIN(plugin))
624 gaim_notify_close_with_handle(plugin); 624 gaim_notify_close_with_handle(plugin);
625 625
626 plugin->loaded = FALSE; 626 plugin->loaded = FALSE;
627 627
628 /* Unload all plugins that depend on this plugin. */ 628 /* Unload all plugins that depend on this plugin. */
629 /* XXX Does this want to be while (plugin->dependent_plugins != NULL) 629 while ((l = plugin->dependent_plugins) != NULL)
630 * instead of this loop? I fixed it to get l->next before calling
631 * gaim_plugin_unload (which can change the list here). This worked
632 * much better for me but I'm not 100% sure it will always work. */
633 for (l = plugin->dependent_plugins; l != NULL; l = l_next)
634 { 630 {
635 const char * dep_name = (const char *)l->data; 631 const char * dep_name = (const char *)l->data;
636 GaimPlugin *dep_plugin; 632 GaimPlugin *dep_plugin;
637
638 l_next = l->next;
639 633
640 dep_plugin = gaim_plugins_find_with_id(dep_name); 634 dep_plugin = gaim_plugins_find_with_id(dep_name);
641 635
642 if (dep_plugin != NULL && gaim_plugin_is_loaded(dep_plugin)) 636 if (dep_plugin != NULL && gaim_plugin_is_loaded(dep_plugin))
643 { 637 {