static void purple_protocol_finalize(GObject *object) { PurpleProtocol *protocol = PURPLE_PROTOCOL(object); GList *accounts, *l; accounts = purple_accounts_get_all_active(); for (l = accounts; l != NULL; l = l->next) { PurpleAccount *account = PURPLE_ACCOUNT(l->data); if (purple_account_is_disconnected(account)) continue; if (purple_strequal(protocol->id, purple_account_get_protocol_id(account))) purple_account_disconnect(account); } g_list_free(accounts); purple_request_close_with_handle(protocol); purple_notify_close_with_handle(protocol); purple_signals_disconnect_by_handle(protocol); purple_signals_unregister_by_instance(protocol); purple_prefs_disconnect_by_handle(protocol); user_splits_free(protocol); account_options_free(protocol); icon_spec_free(protocol); PURPLE_DBUS_UNREGISTER_POINTER(protocol); parent_class->finalize(object); }
static void pidgin_mini_dialog_finalize(GObject *object) { PidginMiniDialog *self = PIDGIN_MINI_DIALOG(object); PidginMiniDialogPrivate *priv = PIDGIN_MINI_DIALOG_GET_PRIVATE(self); if (priv->idle_destroy_cb_id) g_source_remove(priv->idle_destroy_cb_id); g_free(priv); self->priv = NULL; purple_prefs_disconnect_by_handle(self); G_OBJECT_CLASS (pidgin_mini_dialog_parent_class)->finalize (object); }
void purple_prefs_uninit() { if (save_timer != 0) { purple_timeout_remove(save_timer); save_timer = 0; sync_prefs(); } purple_prefs_disconnect_by_handle(purple_prefs_get_handle()); prefs_loaded = FALSE; purple_prefs_destroy(); g_hash_table_destroy(prefs_hash); prefs_hash = NULL; }
gboolean purple_plugin_unload(PurplePlugin *plugin) { #ifdef PURPLE_PLUGINS GList *l; GList *ll; g_return_val_if_fail(plugin != NULL, FALSE); g_return_val_if_fail(purple_plugin_is_loaded(plugin), FALSE); purple_debug_info("plugins", "Unloading plugin %s\n", plugin->info->name); /* Unload all plugins that depend on this plugin. */ for (l = plugin->dependent_plugins; l != NULL; l = ll) { const char * dep_name = (const char *)l->data; PurplePlugin *dep_plugin; /* Store a pointer to the next element in the list. * This is because we'll be modifying this list in the loop. */ ll = l->next; dep_plugin = purple_plugins_find_with_id(dep_name); if (dep_plugin != NULL && purple_plugin_is_loaded(dep_plugin)) { if (!purple_plugin_unload(dep_plugin)) { g_free(plugin->error); plugin->error = g_strdup_printf(_("%s requires %s, but it failed to unload."), _(plugin->info->name), _(dep_plugin->info->name)); return FALSE; } else { #if 0 /* This isn't necessary. This has already been done when unloading dep_plugin. */ plugin->dependent_plugins = g_list_delete_link(plugin->dependent_plugins, l); #endif } } } /* Remove this plugin from each dependency's dependent_plugins list. */ for (l = plugin->info->dependencies; l != NULL; l = l->next) { const char *dep_name = (const char *)l->data; PurplePlugin *dependency; dependency = purple_plugins_find_with_id(dep_name); if (dependency != NULL) dependency->dependent_plugins = g_list_remove(dependency->dependent_plugins, plugin->info->id); else purple_debug_error("plugins", "Unable to remove from dependency list for %s\n", dep_name); } if (plugin->native_plugin) { if (plugin->info->unload && !plugin->info->unload(plugin)) return FALSE; if (plugin->info->type == PURPLE_PLUGIN_PROTOCOL) { PurplePluginProtocolInfo *prpl_info; GList *l; prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(plugin); for (l = prpl_info->user_splits; l != NULL; l = l->next) purple_account_user_split_destroy(l->data); for (l = prpl_info->protocol_options; l != NULL; l = l->next) purple_account_option_destroy(l->data); if (prpl_info->user_splits != NULL) { g_list_free(prpl_info->user_splits); prpl_info->user_splits = NULL; } if (prpl_info->protocol_options != NULL) { g_list_free(prpl_info->protocol_options); prpl_info->protocol_options = NULL; } } } else { PurplePlugin *loader; PurplePluginLoaderInfo *loader_info; loader = find_loader_for_plugin(plugin); if (loader == NULL) return FALSE; loader_info = PURPLE_PLUGIN_LOADER_INFO(loader); if (loader_info->unload && !loader_info->unload(plugin)) return FALSE; } /* cancel any pending dialogs the plugin has */ purple_request_close_with_handle(plugin); purple_notify_close_with_handle(plugin); purple_signals_disconnect_by_handle(plugin); purple_plugin_ipc_unregister_all(plugin); loaded_plugins = g_list_remove(loaded_plugins, plugin); if ((plugin->info != NULL) && PURPLE_IS_PROTOCOL_PLUGIN(plugin)) protocol_plugins = g_list_remove(protocol_plugins, plugin); plugins_to_disable = g_list_remove(plugins_to_disable, plugin); plugin->loaded = FALSE; /* We wouldn't be anywhere near here if the plugin wasn't loaded, so * if plugin->error is set at all, it had to be from a previous * unload failure. It's obviously okay now. */ g_free(plugin->error); plugin->error = NULL; purple_signal_emit(purple_plugins_get_handle(), "plugin-unload", plugin); purple_prefs_disconnect_by_handle(plugin); return TRUE; #else return TRUE; #endif /* PURPLE_PLUGINS */ }
BuddyList::~BuddyList() { purple_blist_set_ui_ops(NULL); purple_prefs_disconnect_by_handle(this); }