Try to unregister plugins on exit

This commit is contained in:
Yevgen Muntyan 2006-06-09 16:19:25 -05:00
parent cbc2f8cd19
commit 9174798646
6 changed files with 61 additions and 5 deletions

View File

@ -292,16 +292,16 @@
</kdevdoctreeview>
<kdevfilecreate>
<filetypes>
<type icon="source" ext="g" name="GAP source" create="template" >
<type icon="source" ext="g" create="template" name="GAP source" >
<descr>A new empty GAP source file</descr>
</type>
<type icon="source_cpp" ext="cpp" name="C++ Source" create="template" >
<type icon="source_cpp" ext="cpp" create="template" name="C++ Source" >
<descr>A new empty C++ file.</descr>
</type>
<type icon="source_h" ext="h" name="C/C++ Header" create="template" >
<type icon="source_h" ext="h" create="template" name="C/C++ Header" >
<descr>A new empty header file for C/C++.</descr>
</type>
<type icon="source_c" ext="c" name="C Source" create="template" >
<type icon="source_c" ext="c" create="template" name="C Source" >
<descr>A new empty C file.</descr>
</type>
</filetypes>

View File

@ -1055,6 +1055,9 @@ moo_app_quit_real (MooApp *app)
#ifdef MOO_BUILD_EDIT
moo_editor_close_all (app->priv->editor, TRUE);
moo_plugin_shutdown ();
g_object_unref (app->priv->editor);
app->priv->editor = NULL;
#endif /* MOO_BUILD_EDIT */

View File

@ -979,6 +979,48 @@ moo_plugin_read_dirs (void)
}
void
moo_plugin_shutdown (void)
{
GSList *list;
if (!plugin_store || !plugin_store->dirs_read)
return;
list = g_slist_copy (plugin_store->list);
g_slist_foreach (list, (GFunc) g_object_ref, NULL);
while (list)
{
moo_plugin_unregister (G_OBJECT_TYPE (list->data));
g_object_unref (list->data);
list = g_slist_delete_link (list, list);
}
#ifdef MOO_USE_PYGTK
_moo_python_plugin_deinit ();
#endif
plugin_store->dirs_read = FALSE;
plugin_store->editor = NULL;
if (plugin_store->list)
{
g_critical ("%s: could not unregister all plugins", G_STRLOC);
g_slist_free (plugin_store->list);
plugin_store->list = NULL;
}
g_hash_table_destroy (plugin_store->names);
plugin_store->names = NULL;
g_strfreev (plugin_store->dirs);
plugin_store->dirs = NULL;
plugin_store = NULL;
}
void
_moo_window_attach_plugins (MooEditWindow *window)
{

View File

@ -212,6 +212,7 @@ const char *moo_plugin_version (MooPlugin *plugin);
char **moo_plugin_get_dirs (void);
void moo_plugin_read_dirs (void);
void moo_plugin_shutdown (void);
void moo_plugin_set_info (MooPlugin *plugin,
MooPluginInfo *info);

View File

@ -370,6 +370,15 @@ _moo_python_plugin_init (void)
}
void
_moo_python_plugin_deinit (void)
{
Py_XDECREF (main_mod);
main_mod = NULL;
moo_python_init (MOO_PY_API_VERSION, NULL);
}
#ifdef MOO_PYTHON_PLUGIN
MOO_PLUGIN_INIT_FUNC_DECL;
MOO_PLUGIN_INIT_FUNC_DECL

View File

@ -20,6 +20,7 @@ G_BEGIN_DECLS
gboolean _moo_python_plugin_init (void);
void _moo_python_plugin_deinit (void);
G_END_DECLS