Tidy up plugin cleanup code.

git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@3076 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
Nick Treleaven 2008-10-13 15:40:12 +00:00
parent 567d0634b7
commit 6133c0b5d6
2 changed files with 9 additions and 4 deletions

View File

@ -16,6 +16,8 @@
their visible group elements are hidden or destroyed.
* tagmanager/css.c:
Fix gcc warning, wrap line.
* src/plugins.c:
Tidy up plugin cleanup code.
2008-10-12 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>

View File

@ -662,12 +662,13 @@ static gboolean is_active_plugin(Plugin *plugin)
}
/* Clean up anything used by an active plugin */
static void
plugin_unload(Plugin *plugin)
plugin_cleanup(Plugin *plugin)
{
GtkWidget *widget;
if (is_active_plugin(plugin) && plugin->cleanup)
if (plugin->cleanup)
plugin->cleanup();
remove_callbacks(plugin);
@ -679,7 +680,6 @@ plugin_unload(Plugin *plugin)
if (widget)
gtk_widget_destroy(widget);
active_plugin_list = g_list_remove(active_plugin_list, plugin);
geany_debug("Unloaded: %s", plugin->filename);
}
@ -690,7 +690,10 @@ plugin_free(Plugin *plugin)
g_return_if_fail(plugin);
g_return_if_fail(plugin->module);
plugin_unload(plugin);
if (is_active_plugin(plugin))
plugin_cleanup(plugin);
active_plugin_list = g_list_remove(active_plugin_list, plugin);
if (plugin->module != NULL && ! g_module_close(plugin->module))
g_warning("%s: %s", plugin->filename, g_module_error());