| 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; |
610 GList *l, *l_next; |
| 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)) |
| 616 protocol_plugins = g_list_remove(protocol_plugins, plugin); |
616 protocol_plugins = g_list_remove(protocol_plugins, 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 for (l = plugin->dependent_plugins; l != NULL; l = l->next) |
629 /* XXX Does this want to be while (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) |
| 630 { |
634 { |
| 631 const char * dep_name = (const char *)l->data; |
635 const char * dep_name = (const char *)l->data; |
| 632 GaimPlugin *dep_plugin; |
636 GaimPlugin *dep_plugin; |
| |
637 |
| |
638 l_next = l->next; |
| 633 |
639 |
| 634 dep_plugin = gaim_plugins_find_with_id(dep_name); |
640 dep_plugin = gaim_plugins_find_with_id(dep_name); |
| 635 |
641 |
| 636 if (dep_plugin != NULL && gaim_plugin_is_loaded(dep_plugin)) |
642 if (dep_plugin != NULL && gaim_plugin_is_loaded(dep_plugin)) |
| 637 { |
643 { |