summaryrefslogtreecommitdiff
path: root/libpeas/peas-object-module.c
diff options
context:
space:
mode:
authorGarrett Regier <garrettregier@gmail.com>2014-09-10 01:58:06 -0700
committerGarrett Regier <garrettregier@gmail.com>2014-12-20 09:09:59 -0800
commit5751032b551aa19e6d75dde4332b0dfaeaa2f708 (patch)
treecc093c0e18979f4e9cd3cadbd77bcf5c78949999 /libpeas/peas-object-module.c
parent5b172412a63855cf0762032711a7eba3bccd2562 (diff)
downloadlibpeas-5751032b551aa19e6d75dde4332b0dfaeaa2f708.tar.gz
Free the registered extension impls when the object module is unloaded
When the object module is reloaded they will all be added again as peas_register_types() will be called. This caused problems when checking if the interface was already registered as it was always already registered when reloading the module.
Diffstat (limited to 'libpeas/peas-object-module.c')
-rw-r--r--libpeas/peas-object-module.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/libpeas/peas-object-module.c b/libpeas/peas-object-module.c
index 1f36ec7..474a173 100644
--- a/libpeas/peas-object-module.c
+++ b/libpeas/peas-object-module.c
@@ -147,11 +147,23 @@ static void
peas_object_module_unload (GTypeModule *gmodule)
{
PeasObjectModule *module = PEAS_OBJECT_MODULE (gmodule);
+ InterfaceImplementation *impls;
+ guint i;
g_module_close (module->priv->library);
module->priv->library = NULL;
module->priv->register_func = NULL;
+
+ impls = (InterfaceImplementation *) module->priv->implementations->data;
+ for (i = 0; i < module->priv->implementations->len; ++i)
+ {
+ if (impls[i].destroy_func != NULL)
+ impls[i].destroy_func (impls[i].user_data);
+ }
+
+ g_array_remove_range (module->priv->implementations, 0,
+ module->priv->implementations->len);
}
static void
@@ -168,17 +180,9 @@ static void
peas_object_module_finalize (GObject *object)
{
PeasObjectModule *module = PEAS_OBJECT_MODULE (object);
- InterfaceImplementation *impls;
- unsigned i;
g_free (module->priv->path);
g_free (module->priv->module_name);
-
- impls = (InterfaceImplementation *) module->priv->implementations->data;
- for (i = 0; i < module->priv->implementations->len; ++i)
- if (impls[i].destroy_func != NULL)
- impls[i].destroy_func (impls[i].user_data);
-
g_array_unref (module->priv->implementations);
G_OBJECT_CLASS (peas_object_module_parent_class)->finalize (object);